Repository navigation
Let an include find its lines by regexp or Go symbol - #339
Merged
Merged
Conversation
An include block could only pick lines by number, so its window slid off the right lines whenever the file changed above them. This is steps 1 to 3 of docs/spilled-output/design.md, the part that is useful on its own before out=file: - match="re" starts at the first line matching a Go regexp; before=N adds lines above, lines=N or until="re" ends the window. - symbol=Name shows a Go func, method (T.Method or (*T).Method), type, const or var with its doc comment, found with go/parser; comment=false drops the comment. Grouped consts and vars are their own lines. Other languages are a no-match warning for now. - match= and symbol= exclude from= and to=, lines= excludes until=, and nth= is reserved, all as parse errors. - A window that finds nothing is empty, with a warning on stderr, a "no match" badge in mdsh-gui and a note in the TUI; it doesn't fail the run. - Numbering starts at the window's first line everywhere: printing, the TUI, mdsh-gui (Result.FirstLine) and the PDF gutter. - mdsh-gui labels a windowed include by how it finds its lines and drops the range grips, which only move from= and to=. - lines= now means one thing on an include and another on a textbox, so attribute lookups for the language server and the editor's help take the block kind into account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9mexoiqFA4n1PYQWSzMDS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by j · project thread
Steps 1–3 of
docs/spilled-output/design.md: the include window attributes and Gosymbol=.out=file(steps 4 onward) follows in later PRs.What changes
match="re"starts the window at the first line matching a Go regexp.before=Nadds lines above, andlines=Noruntil="re"ends it. Without either, the window runs to the end of the file.symbol=Nameshows a Go func, a method (T.Methodor(*T).Method), a type, a const or a var, with its doc comment. It is found withgo/parser, so there are no new dependencies.comment=falsedrops the comment. Grouped consts and vars show only their own lines. When several definitions share the name, the first is used and mdsh warns. Other languages give a no-match warning for now (tier 2 is a later step).match=andsymbol=can't go with each other or withfrom=/to=,lines=can't go withuntil=/to=, andnth=is reserved.mdsh: d.md: warning: line 3: include: no line of b.log matches "^FAIL"), mdsh-gui shows a no match badge, and the TUI shows a note.Result.FirstLineandCell.FirstLine) and the PDF gutter.match "^--- FAIL", 1 before, 5 lines). It has no range grips, because those only movefrom=/to=, andSetIncludeRangerefuses it. The whole-file dialog marks the window.lines=now means one thing on an include and another on a textbox, so the language server's and the editor's attribute lookups take the block kind into account (doc.LookupAttrFor).examples/include.md(now with a match/until and a Go symbol example), and a CHANGELOG entry with a screenshot.Screenshots
mdsh-gui (
--serve, light): a log window from the first--- FAIL, numbered from line 42; a Go method bysymbol=; and amatchthat found nothing.The dark scheme and the whole-file dialog are in the project files under
include-windows/.Testing
go test ./...passes.TestStressScalesfailed once under full-suite load, then passed 3/3 when run on its own.run.TestWindow(incl. CRLF and no final newline),TestWindowSymbol,TestIncludeWindow,doc.TestIncludecases,notebook.TestIncludeWindowCell,cmd/mdsh.TestIncludeNoMatch.tscshowed no errors in the changed files). Thecmd/mdsh-guivendor copy andweb/bundleare regenerated.go generateneeds GTK, which isn't in this container). I editedmodels.tsby hand to match what the generator emits, and CI's bindings check will confirm it.Generated by Claude Code