Skip to content

feat: add workspace symbols and engine-exact .menu handling - #5

Merged
4Luke4 merged 16 commits into
mainfrom
feat/workspace-symbols
Oct 29, 2026
Merged

4Luke4 merged 16 commits into
mainfrom
feat/workspace-symbols

Conversation

@4Luke4

@4Luke4 4Luke4 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

What and why

The next step from plan.md after #4: workspace symbols (Go to Symbol in Workspace, workspace/symbol). #4 said workspace-wide results would come with it.

The PR also brings the .menu support in line with the engine, using what IESDP documents about the format. The IESDP pages were checked against the executables of BGEE, BG2EE and IWDEE 2.6.6.0 and 2.7.3.0. Every fact is cited in the code with the page and the IESDP commit (38e7532).

Decisions taken with the maintainer before implementation:

Question Decision
Next feature Workspace symbols
New .menu checks All four: the last character before a closing backtick, unquoted words of 64+ characters, _ in unquoted text, and slotinfo/spellInfo/memorizedSpellInfo
What the workspace scan skips The client's files.exclude, applied as VS Code's explorer applies it, with a built-in matcher (no new dependency)
Activation Add workspaceContains, so Ctrl+T works before a file is opened (manifest change, see commit 11)

What IESDP showed the old .menu code got wrong

Counts are from the game's own UI.MENU, run locally. It is gitignored, and nothing from it is copied.

IESDP fact Before Effect
'…' and "…" are the same kind of string '…' was never Lua 52 Lua values missed
A word that is not a keyword is a STRING Ignored table characterDetails, enabled currentSave and 3 more missed, so navigation missed those names
table, seperator, useOverlayTint, bitmap res are expressions; actiondrag is an expression Only enabled and lua counted as expressions; actiondrag was treated as statements 130 values never checked, 11 checked in the wrong form
The grammar works on tokens, not lines A property had to be the only word on its line 92 one-line button { name "…" … } blocks had no name; 4 clickable lua values were missed (lua and " on different lines)
Property code is compiled as function <p><addr> () <code> end, or with return <code> for expressions Compiled as a top-level chunk ... and a trailing -- comment (which swallows the end) were wrongly accepted
The lexer drops the last character before a closing backtick The whole block was checked `x = 1` runs as x = in the game
slotinfo/spellInfo/memorizedSpellInfo STRINGs are pasted into generated Lua Ignored 136 values not checked or navigable
The runtime opens only _G, table, string, bit32, math, debug (io, os, package are test-automation stubs) Not recorded anywhere Recorded in CLAUDE.md for hover and completion. Syntax is unaffected.

Commits (one concern each; review them one by one)

# Commit What it changes
1 feat(server): lex .menu files as the engine does menuLexer.ts follows IESDP's lexical rules. menuKeywords.ts is the engine's 122-keyword table, verbatim.
2 fix(server): find all the Lua in .menu files The extractor works on tokens and uses IESDP's full list of Lua properties. Its public API is unchanged. Audit by diff on UI.MENU: all 3,109 old chunks are found again at the same offsets with the same text, plus 191 new ones (breakdown in the commit message).
3 fix(server): validate .menu Lua in the form the engine compiles LuaChunk.forms holds the text compiled around the code, and region the chunk's range with its delimiters. Errors in the added text map to the edge of the chunk. Parser option functionBody: no ..., and one level deeper. Also fixes a pre-existing off-by-one in expression mode's nesting limit (199 parentheses were accepted).
4 feat(server): validate slotinfo, spellInfo and memorizedSpellInfo 10, 6 and 6 generated forms, verbatim from IESDP.
5 feat(server): report .menu text the engine misreads Three new stable codes: menu-inline-lua-last-character (warning), menu-word-too-long (error), menu-unquoted-underscore (warning). menu-unterminated-string now also covers '. Problem.severity is new.
6 fix: highlight all the Lua in .menu files The TextMate grammar follows the extractor. A unit test keeps its keyword and property lists in sync with the TypeScript.
7 docs: record where engine facts come from and the engine's Lua libraries CLAUDE.md §7.
8 feat(server): add a glob matcher for files.exclude An original implementation of VS Code's files.exclude semantics, read from its source at 1.91.0 and 1.144.0 (see testing below).
9 feat(server): index the Lua and .menu files of the workspace WorkspaceIndex: background scan, one file per macrotask. It honors files.exclude, never follows links to folders, and updates on file events, folder changes and settings changes. The file system is injected.
10 feat(server): add workspace symbols The handler and the server wiring: watchers, workspace folders, a single didChangeConfiguration handler. Open documents win over their saved version.
11 feat: activate when the workspace contains Lua or .menu files Manifest change: workspaceContains:**/*.[lL][uU][aA] and workspaceContains:**/*.[mM][eE][nN][uU]. No command or setting was renamed.
12 docs: document workspace symbols and the engine-exact .menu checks README, the editor guide (what other clients need), CLAUDE.md and CONTRIBUTING layout.
13 perf(server): lex .menu files without a regular expression per character Found by measuring: commit 1 doubled extraction time (5.6 → 11.5 ms). It now takes 3.3 ms, with output identical on UI.MENU and on 20,000 random inputs.
14 fix(server): keep workspace symbol requests from waiting on later file events Fixes a project /review finding (below).
15 test(server): check the workspace index with Windows paths Fixes a /review finding: CI is Linux-only.
16 test: cover the Node file system adapter and tidy review nits /review nits.

Changelog entries (CHANGELOG.md and docs/CHANGELOG.vsix.md) were added in the commits that make each change. Nothing has been released yet, so the existing [Unreleased] .menu entry was corrected rather than adding a "Fixed" entry for unreleased behaviour.

Project /review findings and what was done

Finding Severity Outcome
ready() waited for work queued after the call, so a stream of file events could hold a request up Should fix Fixed (commit 14). The files.exclude rescan now runs inside its own job. While a file is re-read, its old entry stays.
Windows path handling (separators, drive letters, file:///c%3A/…) not exercised Should fix Fixed (commit 15): unit test with path.win32
A missing file was logged as a read failure Nit Fixed: ENOENT is quiet, other errors are still logged
Node fs adapter not unit-tested; exported tables unexplained; tight re-query loop in an integration helper Nit Fixed (commit 16)
Every file created in the workspace is probed with one readdir to detect folders Nit Kept. It costs one call per created file, and checking exclusion first would cost more calls.
The new menu messages are English only Nit Kept, consistent with the existing .menu and compiler messages; listed under limitations

How it was tested

Locally (Linux/WSL2, Node 24.22.1):

  • Passed: check-types; lint (0 warnings); test:unit (272 passing, up from 186); check-l10n.
  • Packaging: package, then notices -- --check, then vsce package + vsce ls. The VSIX allow-list is unchanged.
  • commitlint passes on all 16 commits and on the title. No workflow changed, so actionlint was not needed.
  • npm test: 29 passing on both VS Code 1.91.0 and 1.144.0 (7 new).
    • Workspace symbols:
      • a never-opened file;
      • a .MENU file's menu and Lua symbols;
      • loose matching;
      • unsaved edits, and their removal when the document is closed without saving;
      • .lua and .MENU files created and deleted outside the editor, which shows the [] watcher globs work;
      • files.exclude set and restored at run time.
    • Diagnostics: a warning, and an error that only the engine's compile form produces (... in an action).

.menu changes on the game's UI.MENU (local only):

  • Chunks: 3,109 before; 3,436 now (3,300 after commit 2, plus 136 shorthands).
  • 0 diagnostics before and after, with every chunk compiled in the engine's exact form. None of the three new checks fires, so there are no false positives on the game's own file.

Parser vs. the official compiler on the new forms:

  • The differential test now also compares the parser in functionBody mode with the compiler on the wrapped text: corpus, seeds, 1,600 mutations, and the nesting limit.
  • The limit is 198 parentheses inside return, and 200 do blocks inside the function.

Glob matcher vs. VS Code's own glob.ts (1.144.0 sparse clone, bundled with esbuild in a scratch directory, not committed):

  • 0 mismatches in 2,412,400 pattern/path checks: 6,031 generated and hand-picked patterns, 49,107 matches.
  • 0 mismatches in 735 files.exclude expression checks, including when clauses.
  • The committed glob unit tests also pass unchanged against VS Code's implementation.

TextMate grammar: tokenized sample lines with vscode-textmate 9.2.0 + vscode-oniguruma 2.0.1, installed outside the repo, and VS Code 1.144.0's Lua grammar.

Activation: a one-off test (it needs workspaces of its own) on VS Code 1.144.0. It never calls activate() and has no editor open.

  • A workspace holding only deep/ONLY.MENU activates and serves its symbol.
  • So does one holding only Script.LUA.
  • Control: with the previous manifest, the .MENU workspace never activates (20 s timeout).

Timings on UI.MENU (medians of 15 runs; same machine, measured against a main worktree):

main This branch
Extract the Lua 5.84 ms 4.70 ms
Parse + scopes (shared cache) 25.89 ms 27.07 ms (327 more chunks)
Validate (official compiler) 17.54 ms 24.12 ms (327 more chunks; the 136 shorthands each compiled in 6–10 forms)
Index one file for workspace symbols — 25.62 ms (785 symbols)
Workspace symbol query ("" / "infpush") — 0.040 / 0.066 ms

Everything stays under the ~50 ms event-loop budget from .claude/rules/language-server.md, and the index yields between files.

Bundle size:

  • Server: 407,409 → 420,851 bytes (+13,442, +3.3%).
  • Client: unchanged (437,728 bytes).
  • Still 10 npm packages in the notices; no new dependency.

CI baseline (#4's last run, for the timing review in the comments): checks 25 s, integration minimum 33 s, integration stable 37 s, WASM reproducibility 29 s, CodeQL JS/TS 60 s, CodeQL actions 40 s, commitlint 18 s.

Known limitations

  • Local folders only. Virtual workspaces (vscode-vfs: and the like) get their open documents only.
  • Editors without workspace folders (the deprecated rootUri is not used) get open documents only.
  • Editors without dynamic registration of watched files see files changed outside the editor only after a restart, or after the file is opened and closed.
  • files.exclude only. search.exclude and .gitignore are not applied, as in VS Code's explorer by default. A nested workspace folder is also scanned under the rules of the folder that contains it.
  • Errors from the engine's own .menu grammar (its Invalid token in menu messages, from the Lemon parser) are not reported yet. Only lexical problems and Lua errors are.
  • The new .menu diagnostic messages are English, like the existing .menu and compiler messages.
  • Unquoted Lua words are not highlighted as Lua (table characterDetails), though they are checked. TextMate cannot follow the engine's tokens.
  • Windows is covered by unit tests only. CI runs on Linux; the index is tested with path.win32, but not on a real Windows file system.

Checklist

  • npm run check-types, npm run lint and npm run test:unit pass
  • npm test (integration) passes, if activation, commands, settings or the LSP wiring changed
  • New logic has unit tests; new commands/settings have an integration test (no new commands or settings; workspace symbols and the new diagnostics have integration tests)
  • User-facing strings use vscode.l10n.t() / package.nls.json, and npm run check-l10n passes (no new client strings; server diagnostics are English, as before)
  • CHANGELOG.md and docs/CHANGELOG.vsix.md have entries under [Unreleased] (if users notice the change)
  • No setting key or command ID was renamed (breaking change), or it is called out above (activation events added: commit 11)

🤖 Generated with Claude Code

4Luke4 and others added 16 commits October 29, 2026 12:44
The .menu scanner splits text into lines and words with its own rules,
which differ from the engine. Add a lexer that follows the IESDP
description of the engine's lexer (menu_v1.htm, commit 38e7532; checked
against BGEE, BG2EE and IWDEE 2.6.6.0 and 2.7.3.0):

- `"…"` and `'…'` are the same kind of string: no escapes, may span
  lines, and an unterminated one runs to the end of the file;
- a word is a run of ASCII letters and digits not starting with a digit;
  `_`, `.` and other characters are skipped, so `My_Menu` is `My` then
  the keyword `menu`;
- a word that is not one of the 122 keywords (matched case-insensitively)
  is a string token;
- `--` comments, `{`, `}`, `-` and numbers;
- `` `…` `` inline Lua produces no token and is returned separately.

menuKeywords.ts holds the engine's keyword table verbatim. Nothing uses
the lexer yet; the extractor moves onto it in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extractor took a property from the first word of the current or
previous line and only knew part of the engine's rules, so it missed
Lua the engine compiles. It now works on the tokens of the new lexer and
on the IESDP list of properties whose STRING is Lua ("How a menu becomes
Lua", menu_v1.htm, commit 38e7532):

- statements: onopen, onclose, action, actionalt, actiondbl,
  actionenter, actionexit, actionUpdate, actionsimpledrag,
  actionsimpledrop, actionHold, actionScroll;
- expressions: enabled, actiondrag, table, seperator, useOverlayTint,
  `bitmap res` and every `lua STRING` value.

A STRING is `"…"`, `'…'` or an unquoted word that is not a keyword, and
the property is the token just before it, wherever it sits on the line.
Block keywords are the keyword just before `{`, and a block's name is the
STRING after its first `name` keyword.

Effect on the game's UI.MENU (local check, nothing copied): the 3,109
chunks found before are all still found, at the same offsets and with the
same text, plus 191 new ones:
- 56 `bitmap res "…"`;
- 65 `table`, 5 `seperator` and 4 `useOverlayTint` values;
- 52 single-quoted values (51 `lua '…'`, 1 `enabled '…'`);
- 5 unquoted words (`table characterDetails`, `enabled currentSave`, …);
- 4 `clickable lua` values whose `"` is on the line after `lua`.
The 11 `actionDrag` scripts are now expressions, as the engine compiles
them, instead of statements. 92 one-line `button { name "…" … }` blocks
now get their name. All other blocks are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IESDP ("How a menu becomes Lua", menu_v1.htm, commit 38e7532) gives the
exact text the engine compiles for each property string:

  function <prefix><address> () <code> end          -- statement form
  function <prefix><address> () return <code> end   -- expression form

and says the lexer drops the last character before a closing backtick.
We compiled property code as a top-level chunk (with `return ` in front
of expressions) and backtick blocks in full, so we accepted code the
engine rejects:
- `...` in property code (the generated function is not vararg);
- a `--` comment on the last line, which comments out the `end`;
- `` `x = 1` ``, which the engine runs as `x = `;
- statements after an expression (`enabled "a return b"`).

- LuaChunk gains `forms` (prefix and suffix, without line breaks, so
  compiler lines are still chunk lines) and `region` (the document range
  with delimiters). The engine's function name is `f`, since any name
  gives the same syntax.
- validateChunk compiles every form and reports the first failure. A
  `near '<token>'` that is unique on the compiled line and lies in the
  added text maps to an empty range at the edge of the chunk.
- Backtick chunks are the text the engine runs, without the last
  character.
- parser: new `functionBody` option, used for property chunks: `...` is
  rejected and statements start one level deeper, as inside the
  generated `function` statement. The differential test now also checks
  the parser against the compiler on the wrapped forms, including the
  nesting limit (198 parentheses in an expression, 200 `do` blocks).
- parser: the implied `return` of `expression` mode now counts as a
  statement level, like lparser.c `statement`. Before, 199 nested
  parentheses were accepted while `return` + 199 is rejected.
- folding: the fold of a chunk's delimiters uses `region`, since the
  text of a backtick block no longer reaches the closing backtick.

The game's UI.MENU (local check) still gives 0 diagnostics, across all
3,300 chunks. Validating it takes 25.9 ms (median of 15) instead of 23.2 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
These three slot properties are shorthands: the engine pastes their
STRING T into generated properties (IESDP, menu_v1.htm commit 38e7532,
Item properties › Slots), for example `icon lua "T.item.icon"`,
`action = expression Infinity_SwapSlot(T.id)` and
`actionalt = statement showSpellDetails(T, false)`. They were not
recognized at all.

Their STRING is now an expression chunk whose `forms` are the generated
Lua, verbatim from IESDP: 10 forms for slotinfo, 6 each for spellInfo
and memorizedSpellInfo (`bam lua "'IVSLOT'"` does not contain T and is
left out). Validation reports the first form that fails, so
`slotinfo "1"` is rejected (`return 1.item.icon` is not Lua) although
`1` is a valid expression. The names in T (`characters`, `id`, …) now
take part in navigation like any other expression.

UI.MENU (local check): 136 more chunks (3,436), still 0 diagnostics.
Validating it takes 31.2 ms (median of 15), within the 50 ms budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IESDP (menu_v1.htm, commit 38e7532) describes three ways the engine
reads a .menu file differently from how it looks. Each now has a
diagnostic with a stable code:

- menu-inline-lua-last-character (warning): "The engine drops the last
  character before the closing backtick". The range is that character,
  when it is not white space.
- menu-word-too-long (error): "A word of 64 or more characters makes the
  engine abort". Quoted strings are not limited.
- menu-unquoted-underscore (warning): `_` is not part of a word, so
  unquoted `My_Menu` is the string `My` followed by the keyword `menu`.
  Reported once per run of letters, digits and `_`, naming the parts the
  engine reads, with the quoted form as the fix.

`menu-unterminated-string` now also covers `'` strings, which the engine
treats like `"` strings, and names the missing quote.

Problem gains `severity`; features/diagnostics.ts maps it to the LSP
severity, and every existing problem stays an error.

The game's UI.MENU (local check): none of the three fires; still 0
diagnostics. New fixture MISREAD.MENU and an integration test check a
warning and an error that only the engine's compile form produces
(`...` in an action), on VS Code 1.91.0 and 1.144.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The grammar embedded Lua only after action*/onOpen/onClose/enabled at
the start of a line, or after `lua`, and only in `"…"` strings; it
marked as elements only the item types found in UI.MENU (`slot` was
missing) and any first word of a line as a property.

It now follows the extractor:
- Lua after every statement and expression property, the slot
  shorthands, `bitmap res` and `lua`, anywhere on a line, in `"…"` and
  `'…'` strings, with comments allowed in between;
- the engine's 122 keywords (case-insensitive) as properties, and the
  item types plus menu/column as elements when a block follows;
- numbers as the engine reads them (runs of digits).

TextMate matches regular expressions, not the engine's tokens, so
unquoted Lua words (`table characterDetails`) are not highlighted as
Lua; the grammar's comment says so. A new unit test checks the keyword,
element and Lua property lists against menuKeywords.ts and
menuExtractor.ts (whose property sets are now exported for it).

Checked by tokenizing sample lines with vscode-textmate 9.2.0 and
vscode-oniguruma 2.0.1, installed outside the repository, using
VS Code 1.144.0's own Lua grammar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md now points to the IESDP MENU format and Engine Lua globals
pages as the source for engine behaviour, and records that the engine's
Lua state opens only _G, table, string, bit32, math and debug, replaces
print, and has io, os and package only as test-automation stubs
(lua_globals.htm, commit 38e7532). This matches plan.md's help-text
scope and is a constraint for hover and completion.

No code change: these libraries do not affect syntax, and the embedded
compiler's LUA_COMPAT_ALL changes only library functions, so the
diagnostics stay the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workspace symbols will scan the workspace folders and skip what the
user's `files.exclude` hides. No new dependency: glob.ts and
filesExclude.ts are an original implementation of the semantics VS Code
gives that setting, read from its source at tags 1.91.0 and 1.144.0
(same behaviour at both):

- glob.ts follows `parseRegExp` in src/vs/base/common/glob.ts: `**`
  segments, `*`, `?`, `{a,b}` (non-nesting, choices are patterns),
  `[…]` with ranges and `!`/`^` negation, `/` or `\` as separators in
  the matched path, case-sensitive, and the same handling of malformed
  patterns (unterminated `{`/`[`, stray `}` and `]`).
- filesExclude.ts follows the explorer's FilesFilter
  (explorerViewer.ts): patterns are matched against the path relative
  to the workspace folder; `false` disables a pattern; `{ when }` needs
  the sibling named by `when`, with the first `$(basename)` replaced by
  the name without its extension; any other value enables the pattern.

Verified locally against VS Code's own glob.ts (1.144.0, bundled with
esbuild in a scratch directory, not committed): 0 mismatches in
2,412,400 pattern/path checks (6,031 generated and hand-picked
patterns, 49,107 matches), 0 mismatches in 735 files.exclude
expression checks with sibling clauses, and the new unit tests pass
unchanged against VS Code's implementation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WorkspaceIndex keeps, for every *.lua and *.menu file (any letter case,
as documentKind recognizes them) under the `file:` workspace folders,
a value computed from its text: the outline, for workspace symbols.

- Scans walk each folder depth first and skip what files.exclude hides
  (read per folder, matched relative to it with real sibling listings
  for `when` clauses). Excluded folders are not entered, and neither are
  symbolic links to folders, so links cannot loop; links to files are
  read.
- Files are read one per macrotask (an injected yield), so a large
  workspace never blocks the server; UI.MENU takes ~25 ms to parse,
  under the 50 ms rule.
- Text is decoded as UTF-8 with the BOM removed and invalid bytes
  replaced, as VS Code opens files by default.
- Files are keyed by native path, with a Windows drive letter in lower
  case, so a disk entry and an open document match whatever the URI
  spelling. URIs are the folder's URI plus percent-encoded segments.
- Updates: fileChanged (created, changed, or closed in the editor:
  re-read, if still in a folder and not excluded, checking each parent
  folder against files.exclude; a created folder has its files
  indexed), fileDeleted (the file or everything under a deleted
  folder), setFolders, and settingsChanged, which re-reads files.exclude
  and rescans only if it changed, since clients notify every settings
  change. A newer scan stops an older one. Work runs in order on one
  queue; ready() resolves when the work queued so far is done, including
  the work it queues itself.
- Non-`file:` folders (virtual workspaces) are logged and skipped.

Everything is injected (file system, path functions, analysis,
files.exclude lookup, yield, log), so the tests use an in-memory file
system. The server wiring comes with workspace symbols.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
workspace/symbol ("Go to Symbol in Workspace") over the workspace index
and the open documents.

- features/workspaceSymbols.ts: the index keeps the flat outline of each
  file (fileSymbols: the existing documentSymbols, through the flat
  conversion now extracted from toLspSymbols as flatSymbols). Results
  are the open documents' symbols (from the parse cache, so unsaved text
  wins) and those of indexed files that are not open, matched by key.
  The handler first waits for queued indexing, and stops on
  cancellation, both while waiting and while collecting.
- syntax/workspaceSymbols.ts: matchesQuery follows the LSP 3.17 rule of
  thumb: the query's characters in order, case-insensitively; an empty
  query matches everything.
- server.ts:
  - creates the index with the Node file system adapter
    (workspace/nodeFileSystem.ts; readdir withFileTypes reports links
    without following them);
  - reads files.exclude per folder via workspace/configuration;
  - yields with setImmediate;
  - starts scanning on `initialized`, since requests to the client are
    not allowed before it;
  - registers watchers when the client supports dynamic registration:
    `**/*.[lL][uU][aA]`, `**/*.[mM][eE][nN][uU]` (LSP globs are
    case-sensitive), and `**/*` for creates and deletes only (folders);
  - follows workspace folder changes when supported, with the
    `workspaceFolders` server capability;
  - re-reads a file from disk when its document closes.
- The connection keeps one didChangeConfiguration handler, so
  diagnostics.register now returns its handler and server.ts calls it,
  then index.settingsChanged().
- Clients that don't send workspaceFolders get open documents only; the
  deprecated rootUri is not used.

Integration tests on VS Code 1.91.0 and 1.144.0 (29 passing, 6 new):
- a never-opened file;
- a .MENU file's menu and Lua symbols;
- loose matching;
- unsaved edits, and their removal when the document is closed without
  saving;
- .lua and .MENU files created and deleted through workspace.fs, which
  shows the `[]` watcher globs work;
- files.exclude, set and restored at run time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Until now the extension activated only when a Lua or ie-menu document
was opened, so Go to Symbol in Workspace found nothing before then.
Add `workspaceContains:**/*.[lL][uU][aA]` and
`workspaceContains:**/*.[mM][eE][nN][uU]`: any letter case, the same
rule as the index and its file watchers. CLAUDE.md allows explicit
`workspaceContains` events when needed; `onLanguage:lua` stays.

Manifest change: the extension now also starts in folders that hold
such files without one being opened.

Verified with a one-off test on VS Code 1.144.0 (not committed; it needs
workspaces of its own), which never calls activate() and has no editor
open:
- a workspace holding only `deep/ONLY.MENU` activates, and its symbol
  is served;
- so does one holding only `Script.LUA`;
- control: with the previous manifest, the `.MENU` workspace never
  activates (20 s timeout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: workspace symbols in the note and the feature list; the .menu
  bullet now says what is checked (every Lua the game compiles, in the
  form it compiles it, including slotinfo/spellInfo) and that warnings
  flag text the game misreads, with a link to the IESDP format page.
- docs/editors/README.md: the workspace/symbol row, a note on the
  menu warnings, and what the feature needs from an editor (workspace
  folders; dynamic watched-file registration; files.exclude through
  workspace/configuration, with an example for editors that pass
  settings that way; local folders only).
- CLAUDE.md purpose line and layout, CONTRIBUTING layout:
  src/server/workspace/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by measuring on the game's UI.MENU: the new lexer made extraction
of the Lua in a .menu file twice as slow as the scanner it replaced
(11.5 ms vs 5.6 ms, medians). Lexing took 7.9 ms of that, for 35,836
tokens, because isLetter/isDigit ran a regular expression on every
character and comments were skipped one character at a time.

Letters and digits are now classified by comparing characters, and a
comment ends at the next line break found by a sticky search. Lexing
takes 2.5 ms and extraction 3.3 ms, faster than before this branch.

Same output: the optimized lexer gives deep-equal results to the
previous commit's on UI.MENU and on 20,000 random inputs (letters,
digits, `_`, quotes, backticks, braces, comments, CR/LF, VT/FF and
non-ASCII characters); local check, not committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e events

Findings of the project /review on this branch:

- `ready()` waited until the queue was empty, including work queued
  after the call, so a steady stream of file events (a build writing
  .lua files) could hold a Go to Symbol in Workspace request until it
  was cancelled. It now waits for the work queued before the call. The
  one case that relied on the old loop, the rescan that a files.exclude
  change triggers, now runs inside the settingsChanged job itself.
- Re-reading a changed file removed its entry first, so the file
  dropped out of results while it was read. The previous entry now
  stays until the new one is ready, and is removed only when the file
  is excluded or cannot be read.
- A file that is gone (ENOENT: deleted meanwhile, a closed document
  whose file was deleted, a dangling link) is no longer logged as a read
  failure; other read errors still are.

New tests:
- a request returns while later work never completes;
- the files.exclude rescan is still waited for;
- no log for a vanished file, while EACCES is still logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Finding of the project /review: CI runs on Linux only, so the
workspace index's Windows handling (`\` separators in relative paths
and folder prefixes, lower-case drive letters in keys, URIs built from
a `file:///c%3A/…` folder) was never exercised.

The in-memory file system now takes a separator, and a new test runs
the index with `path.win32`. It checks:
- a folder URI as VS Code spells it (`file:///c%3A/Mods`);
- a segment with a space, percent-encoded in the URI;
- files.exclude matched against `/`-separated relative paths;
- an open-document URI with an upper-case drive letter, which maps to
  the same key;
- deleting a folder, which drops the files under it.
It runs on Linux, so it costs no extra CI minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nits from the project /review on this branch:

- New unit test for workspace/nodeFileSystem.ts on a temporary
  directory: files, directories and symbolic links (to a folder and to
  a file) are reported without following links; reading follows a
  link; a missing file rejects with ENOENT, which the index relies on.
- menuExtractor.ts says why its property tables are exported (the
  grammar test checks the TextMate grammar against them).
- waitForWorkspaceSymbols yields one setImmediate between attempts
  instead of re-sending the request in a tight loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@4Luke4

4Luke4 commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

CI timing review, first push (91821eb), per job against #4's last run:

Job #4 This PR
Type-check, lint, unit tests, package 25 s 28 s (272 tests instead of 186)
Integration tests (VS Code minimum, 1.91.0) 33 s 35 s
Integration tests (VS Code stable, 1.144.0) 37 s 39 s
CodeQL javascript-typescript 60 s 62 s
CodeQL actions 40 s 40 s
Conventional Commits 18 s 11 s
Lua 5.2 WASM is reproducible 29 s skipped (no third_party/ change)

No job is anywhere near 2× its baseline, so there is nothing to investigate.

  • Both integration jobs used the cached VS Code (Found existing install) and ran all 29 tests.
  • The unit job ran 272 tests.

🤖 Generated with Claude Code

@4Luke4
4Luke4 merged commit 6ca54c8 into main Oct 29, 2026
10 checks passed
@4Luke4
4Luke4 deleted the feat/workspace-symbols branch October 29, 2026 16:14
4Luke4 added a commit that referenced this pull request Nov 5, 2026
* build(deps-dev): bump @azure/msal-node to 7.2.0 via @azure/identity

Fixes Dependabot alert #5, GHSA-xcx6-jx8p-x3h5 / CVE-2026-109461 (high):
MSAL Node authorization code flow may disclose parameters to an
attacker-controlled endpoint. Affected: >= 5.0.0-beta.0, < 7.1.0.

Path: @vscode/vsce@4.1.0 -> @azure/identity@4.14.0 -> @azure/msal-node@6.0.1
(development only; used by `vsce` for Azure sign-in, never bundled).

@azure/identity 4.14.1 depends on @azure/msal-node ^7.1.0 and is inside
the ^4.13.2 range @vscode/vsce already declares, so `npm update
@azure/identity` fixes it without a manifest change. Lockfile changes:
@azure/identity 4.14.0 -> 4.14.1, @azure/msal-node 6.0.1 -> 7.2.0,
@azure/msal-common 16.14.1 -> 16.16.0. No new packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* build(deps-dev): override serialize-javascript for @vscode/test-cli

Resolves the Dependabot alerts for serialize-javascript 6.0.2:
- alert 2, GHSA-5c6j-r48x-rmvq (high): RCE via RegExp.flags and
  Date.prototype.toISOString(); affected <= 7.0.2
- alert 3, GHSA-qj8w-gfj5-8c6v / CVE-2026-34043 (medium): CPU exhaustion via
  crafted array-like objects; affected >= 5.0.0, < 7.0.5
- alert 4, GHSA-m5mm-p8h7-m29v / CVE-2026-115897 (low): XSS via unescaped
  </script in a serialized function body; affected < 7.1.3

Path: @vscode/test-cli@0.0.15 -> mocha@11.8.0 -> serialize-javascript@6.0.2
(development only; never bundled).

No upstream fix is available: @vscode/test-cli 0.0.15 is the latest release
and requires mocha ^11.7.6, and every mocha 11.x (latest 11.8.0) requires
serialize-javascript ^6.0.2. A scoped `overrides` entry is therefore the
only fix; it is limited to the @vscode/test-cli subtree.

Compatibility: the project's own mocha 12.0.3 already runs on
serialize-javascript 7.1.4 through the same CommonJS
`require("serialize-javascript")` call in lib/nodejs/buffered-worker-pool,
and mocha only loads that module in --parallel mode, which neither
.mocharc.json nor .vscode-test.mjs enables. serialize-javascript 7.1.4
needs Node.js >= 20; the project requires >= 24.

Lockfile: the nested serialize-javascript@6.0.2 and its only dependency
randombytes@2.1.0 are removed (7.1.4 is deduplicated with mocha 12's copy).
Re-resolving the @vscode/test-cli subtree also moved its own dependency
enhanced-resolve 5.26.0 -> 5.26.1 (patch, used only by @vscode/test-cli).

CONTRIBUTING.md records why the override exists and when to remove it
(once @vscode/test-cli depends on mocha >= 12).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scripts): validate EEex docs data and remove file race in sync

Addresses the CodeQL alerts on scripts/eeex-docs/sync.mts:

- js/file-system-race (alert 1, high): main() checked existsSync(file)
  and then read and later wrote the same path. The new readRecorded()
  reads directly and treats only ENOENT as "no data file yet"; any other
  error is rethrown. existsSync is no longer imported.

- js/http-to-file-access (alert 3, medium): writing fetched data to
  data/eeex/<section>.json is the script's purpose, so the data is now
  validated before it is used or written:
  - the Read the Docs build commit and the GitHub source commit must be
    full 40-character lowercase SHAs (isCommitSha). The build commit is
    interpolated into a GitHub API URL, and both are written to
    $GITHUB_OUTPUT, where an embedded newline could have injected step
    outputs.
  - every entry must pass isSafeEntry: a Lua-style identifier name and a
    URL inside DOCS_BASE whose remainder is only RFC 3986 unreserved
    characters, percent-encoded octets, `/` and a single `#`, with no
    `.` or `..` segments. The URL is rendered as a hover link by
    src/server/hover/, so characters that could end a Markdown link or
    start markup are rejected.
  On failure the script stops with an ::error annotation that names the
  offending values (up to 10 entries) and writes nothing.

Both validators live in inventory.mts (pure) and are unit-tested,
including a test that the committed data/eeex/*.json files satisfy
them. Checked against the live upstream: all 1911 entries in the three
sections pass and are identical to the committed data, and
`sync.mts <section> --check` reports no change for each section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): record the security fixes

Adds a "Security" section under [Unreleased] in CHANGELOG.md for the
dependency updates and the EEex docs sync hardening in this branch.

docs/CHANGELOG.vsix.md is unchanged: CONTRIBUTING.md › Changelogs
reserves both files for user-visible changes, and only development
tooling changed; the shipped bundles are identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant