Skip to content

chore: scaffold the IE Lua Language Server foundation - #1

Merged
4Luke4 merged 12 commits into
mainfrom
chore/scaffold-foundation
Oct 28, 2026
Merged

4Luke4 merged 12 commits into
mainfrom
chore/scaffold-foundation

Conversation

@4Luke4

@4Luke4 4Luke4 commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Summary

Scaffolds the IE Lua Language Server foundation: repository hygiene, build and test tooling, a working language server with syntax diagnostics from the official Lua 5.2.4 compiler (WebAssembly), .menu support, localization into all 14 VS Code display languages, release automation, the EEex docs index and CI. Completion, hover, navigation, formatting and the other LSP features from plan.md come in follow-up PRs.

The 12 commits are split one concern each and are meant to be reviewed in order.

Decisions made during planning

Topic Decision
Distribution Private VSIX only. CLAUDE.md wins over plan.md's Marketplace item. release.yml attaches VSIX files to GitHub releases (environment release).
Parsers Official Lua 5.2.4 → WASM now, as the authoritative syntax check. A TypeScript AST parser, which also covers LuaJIT syntax, comes with the LSP features.
EEex-Docs Upstream has no license, tags or releases, so we link instead of copying: data/eeex/ holds names and deep links only. A "release" is the newest successful Read the Docs build of latest.
Minimum VS Code Raised to ^1.91.0, because every vscode-languageclient release since 10.0.0 requires it (approved).
New dependency vscode-languageserver-protocol is declared directly (approved). It was already bundled through client and server, so size is unchanged.

What's included

  • Language server (src/). IPC in VS Code, --stdio for other editors. Diagnostics carry stable codes and source IE Lua. Settings ieLua.validate.mode (manual/save/type/saveAndType, default save) and ieLua.validate.debounce (300 ms). Command IE Lua: Validate Current File.
  • .menu support. New ie-menu language with a TextMate grammar embedding Lua. Only the Lua forms that UI.MENU actually uses are validated; everything else is left alone. On the game's own UI.MENU (588 KB): 3,109 chunks, 0 false positives, median 18 ms.
  • WASM build (third_party/lua52/). The tarball is SHA-256 checked against lua.org, emsdk is pinned to 6.0.13, and the output is byte-for-byte reproducible (npm run build:wasm -- --check, also in CI).
  • Localization. 14 languages, from the official list, which includes Hungarian. npm run check-l10n guards keys, placeholders, setting links and command references.
  • Third-party notices generated from the esbuild metafiles, so they match exactly what ships. CI fails when they're stale.
  • Release tooling (scripts/release/). Follows VS Code's rules: even minor = stable, odd minor = pre-release, always above every earlier version. Bumps come from Conventional Commits. Keeps VERSION, package.json and both changelogs in sync.
  • Two changelogs in Keep a Changelog 1.1.0 format: CHANGELOG.md (detailed, GitHub) and docs/CHANGELOG.vsix.md (user-facing, shipped in the VSIX).
  • Editor guides for Sublime Text, Neovim, Emacs, JetBrains (LSP4IJ), Helix, Kate, Notepad++ (NppLspClient) and Geany, written from each editor's current docs. Zed is documented as unsupported for now, because it only runs servers registered by Zed extensions.
  • Icon rendered by scripts/assets/icon.py: Blender Cycles on the GPU, original artwork.
  • Workflows.
    • ci.yml: checks, VSIX allow-list, integration tests on VS Code 1.91.0 and stable, WASM reproducibility.
    • commitlint.yml, release.yml, dependabot.yml, dependabot-automerge.yml.
    • Three staggered eeex-docs-sync-*.yml jobs.
    • Rewritten codeql.yml and stale.yml.
    • All actions are pinned to commit SHAs, every job has a timeout and least-privilege permissions, and caching is used where it helps.

Verification (local)

  • npm run check-types, npm run lint (0 warnings), npm run test:unit (62 passing), npm run check-l10n, npm run notices -- --check.
  • Integration tests under xvfb: 7/7 passing on VS Code 1.91.0 and on 1.143.1 (stable).
  • The --stdio end-to-end test emulated a non-VS Code client: settings came from initializationOptions, and a .MENU file sent with languageId: "menu" produced the expected diagnostic.
  • Release CLI dry run in a throwaway repo: prepare --channel pre-release gave 0.1.0 and updated all files; verify extracted the notes and refused an existing tag.
  • A fresh clone of this branch passes npm ci and every check; the VSIX packages as 42 files, 247 KB.
  • actionlint 1.7.12: clean.
  • commitlint over all commits: clean.

Needs your attention

  • Translations are machine-produced. Please have native speakers review them.
  • LICENSE.md and SECURITY.md are drafts written by me, not legal advice. Check that the license terms and the response times promised in SECURITY.md (7-day acknowledgement, 14-day updates) are what you want.
  • Workflow shell snippets were not checked with shellcheck locally. Downloading shellcheck was blocked in my session; actionlint's own checks pass.
  • After merge: I'll create the release environment and the main ruleset (required checks, squash-only). The exact commands are in CONTRIBUTING.md › Repository settings, and I'll show them to you before running anything. Until then, Dependabot auto-merge is not gated on CI.

Follow-ups (not in this PR)

TypeScript AST parser with the LuaJIT dialect, then completion, hover (Lua 5.2 manual and LuaJIT docs, linked EEex entries), definition, references, rename, symbols, semantic tokens, folding, formatting, quick fixes and doc comments.

🤖 Generated with Claude Code

4Luke4 and others added 12 commits October 28, 2026 13:10
- .editorconfig and .gitattributes: LF line endings, binary and generated markers.
- .gitignore: Node/build output, local toolchain caches, CLAUDE.local.md.
- .gitmessage: Conventional Commits 1.0.0 template.
- CODEOWNERS: default owner @4Luke4.
- LICENSE.md: proprietary license, all rights reserved.
- SECURITY.md: real support policy and private vulnerability reporting
  instead of the GitHub template placeholder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- package.json: private VSIX manifest (never published), engines.vscode ^1.91.0,
  scripts from CLAUDE.md §3. Version reset to 0.0.0 (nothing released yet).
- esbuild: CommonJS client and server bundles targeting Node 20.9 (Electron 29.4
  in VS Code 1.91), `vscode` external, metafiles for third-party notices.
- TypeScript 6.0 strict type-check only; unit tests and scripts run with Node's
  native type stripping (src/ and test/ are marked "type": "module").
- ESLint (typescript-eslint strictTypeChecked), banning `vscode` imports outside
  the client.
- Mocha unit tests; @vscode/test-cli integration tests against VS Code 1.91.0
  (minimum) and stable.
- commitlint with the Conventional Commits preset.

Runtime dependencies (all bundled by esbuild; production bundles: client 436 KB,
server 375 KB including the 133 KB Lua WebAssembly module):
- vscode-languageclient 11.0.0: language client in the extension host.
- vscode-languageserver 11.0.0 + vscode-languageserver-textdocument 1.0.16:
  language server and incremental document sync.
- vscode-languageserver-protocol 3.18.5: typed custom requests in src/shared
  (environment-neutral entry). Already a dependency of the two packages above,
  so it adds nothing to the bundles.

engines.vscode is raised from ^1.90.0 to ^1.91.0 because every
vscode-languageclient release since 10.0.0 requires it.

TypeScript is pinned to 6.0.x: typescript-eslint 8.72 supports <6.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The syntax checker is the real Lua 5.2.4 front end (CORE_O + lauxlib from the
official Makefile, same -DLUA_COMPAT_ALL), wrapped by a parse-only shim that
calls luaL_loadbufferx in text mode and never runs code or opens libraries.

- build.mts downloads lua-5.2.4.tar.gz from lua.org and verifies the SHA-256
  published on https://www.lua.org/ftp/; Emscripten is pinned to 6.0.13.
- dist/ is committed so development needs no Emscripten; `--check` rebuilds
  into a temp dir and fails unless the output is byte-for-byte identical
  (verified locally twice; CI repeats it when third_party/ changes).
- licenses/ holds the verbatim Lua, Emscripten and musl license texts that
  ship with the module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Language client (IPC) and server (also `--stdio` for other editors).
- Diagnostics from the official Lua 5.2.4 compiler, with stable codes
  (lua-syntax, menu-unterminated-block, menu-unterminated-string) and source
  "IE Lua". Lua reports lines only, so a range covers the offending token
  when it occurs once on the line, and the whole line otherwise.
- New `ie-menu` language for .menu files (matched case-insensitively by VS
  Code) with a TextMate grammar embedding Lua. The server also recognizes menu
  files by extension, so other editors work whatever they call the file type.
- Menu extraction covers what UI.MENU actually uses: backtick blocks and
  action*/onOpen/onClose scripts (statements), enabled "…" and
  <property> lua "…" (expressions). Other properties are not validated.
  On the game's own UI.MENU: 3,109 chunks, 0 false positives, median 18 ms.
- Settings ieLua.validate.mode (manual/save/type/saveAndType, default save)
  and ieLua.validate.debounce (300 ms), read per resource; other clients can
  pass them as settings or initializationOptions.
- Command ieLua.validateDocument (IE Lua: Validate Current File).
- Unit tests (plain Node) and integration tests (VS Code 1.91.0 and stable)
  with original fixtures only.

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

cs, de, es, fr, hu, it, ja, ko, pl, pt-br, ru, tr, zh-cn and zh-tw, the list
on https://code.visualstudio.com/docs/configure/locales. The translations are
machine-produced and need review by native speakers.

scripts/check-l10n.mts (npm run check-l10n) fails when a locale misses a key,
changes a code span, setting link or placeholder, refers to the command by a
title other than its own translation, or when l10n/bundle.l10n.json is out of
date with the vscode.l10n.t() calls (checked with @vscode/l10n-dev).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THIRD_PARTY_NOTICES.md lists exactly the npm packages esbuild put into the
bundles (from its metafiles) with their own license texts, plus Lua 5.2.4,
the Emscripten runtime and musl libc linked into the WebAssembly module.
`npm run notices -- --check` fails in CI when it is out of date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows VS Code's rules: plain major.minor.patch, even minor = stable, odd
minor = pre-release, and every new version above all earlier ones. The bump
comes from Conventional Commits since the last tag (breaking = minor while the
major is 0).

- scripts/release/cli.mts prepare: computes the version and updates VERSION,
  package.json, package-lock.json and both changelogs.
- scripts/release/cli.mts verify: checks consistency, refuses existing tags and
  extracts the release notes.
- CHANGELOG.md (detailed, GitHub) and docs/CHANGELOG.vsix.md (user-facing,
  shipped in the VSIX), both Keep a Changelog 1.1.0.
- VERSION reset to 0.0.0 to match package.json; the first pre-release will be
  0.1.0 and the first stable release 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EEex-Docs has no license, tags or releases, so no documentation text is
copied: data/eeex/*.json holds only names and deep links (1,911 entries for
EEex Functions, EE Game Lua Functions and EE Game Structures (x64)).

Names and anchors come from the Sphinx inventory (objects.inv) of the newest
successful Read the Docs build of `latest`, which is also what counts as a new
upstream release. Each file records that build's commit and the last commit
that touched the section. Rate-limited requests are retried after the delay
the server asks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Original artwork rendered with Blender Cycles on the GPU by
scripts/assets/icon.py (fails instead of falling back to the CPU): a carved
hexagonal stone with a glowing crescent moon ("lua" means moon) and a gold rim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup guides for Sublime Text, Neovim, Emacs, JetBrains IDEs (LSP4IJ), Helix,
Kate, Notepad++ (NppLspClient) and Geany, written from each editor's current
documentation. Zed is documented as not supported yet: it only runs language
servers registered by Zed extensions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ci.yml: type-check, lint, unit tests, l10n, notices, VSIX contents check and
  artifact; integration tests on VS Code 1.91.0 and stable; WASM
  reproducibility when third_party/ changes. Docs-only changes skip the build.
- commitlint.yml: commits and PR title (Dependabot exempt).
- release.yml: dispatch opens a release PR; merging it publishes the GitHub
  (pre-)release with the VSIX from the `release` environment.
- dependabot.yml + dependabot-automerge.yml: weekly grouped updates; low-risk
  ones auto-merge once required checks pass.
- eeex-docs-sync*.yml: weekly, staggered, exits after two API calls when
  nothing changed.
- codeql.yml (actions + javascript-typescript) and stale.yml rewritten from
  the GitHub templates; issue forms and PR template.

Every action is pinned to a commit SHA, every job has a timeout and least
privileges, and npm, VS Code and emsdk are cached. actionlint 1.7.12 passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the template placeholders (purpose, extension ID, output channel name),
records the ^1.91.0 engine, the new folders and scripts, the VSIX changelog
path and the release workflow, and adds the new npm scripts to the allow list.
.github/CLAUDE.md (previous commit) holds the CI conventions.

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

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

upstream: { repository: `https://github.com/${REPOSITORY}`, buildCommit, sourceCommit },
entries,
};
writeFileSync(file, `${JSON.stringify(data, null, 2)}\n`);
if (!response.ok) {
fail(`Downloading ${LUA_URL} failed: HTTP ${response.status} ${response.statusText}`);
}
writeFileSync(tarball, Buffer.from(await response.arrayBuffer()));
Comment thread scripts/eeex-docs/sync.mts Dismissed
if (!response.ok) {
fail(`Downloading ${LUA_URL} failed: HTTP ${response.status} ${response.statusText}`);
}
writeFileSync(tarball, Buffer.from(await response.arrayBuffer()));
@4Luke4
4Luke4 merged commit 2dae9c1 into main Oct 28, 2026
9 of 10 checks passed
@4Luke4
4Luke4 deleted the chore/scaffold-foundation branch October 28, 2026 14:19
4Luke4 added a commit that referenced this pull request Oct 28, 2026
Found while checking the CI timings of this pull request: every
"Integration tests" job, on this branch and on main since #1, logged
`0 passing (0ms)` and succeeded. ci.yml calls `npx vscode-test --label`
directly to pick one VS Code version, which skips npm's `pretest` script
(`node esbuild.mjs --tests`), so out/test/integration/ never existed and
the test glob matched nothing. The suites passed only locally, where
`npm test` runs pretest.

- ci.yml: a "Build extension and integration tests" step runs
  `npm run pretest` before vscode-test (same command as `npm test`).
- .vscode-test.mjs: mocha `failZero: true` (mocha 11.8.0, used by
  @vscode/test-cli, applies it from mochaOpts), so a run without tests
  fails. Verified locally: without the build, `vscode-test --label
  minimum` now ends with "1 test failed." and exit code 1 (before: 0
  passing, exit 0); with it, 11 passing.
- .mocharc.json: `fail-zero` for the unit tests as well (mocha 12
  already fails when no file matches; this covers matching files with
  no tests: exit 1 instead of 0, verified with an empty test file).

actionlint 1.7.12 passes. The integration jobs will take a few seconds
longer for the build and for actually running the 11 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4Luke4 added a commit that referenced this pull request Oct 28, 2026
* ci(release): publish only when a release pull request is merged

The publish job ran on every push to main that touched VERSION. The
scaffold PR (#1) reset VERSION to 0.0.0 and so started a release run on
main that failed in "Verify version" (run 40704747499: CHANGELOG.md has
no non-empty "## [0.0.0] - YYYY-MM-DD" section). Nothing was published,
but the failure was noise, and the next version change would repeat it.

publish now also requires the pushed commit to start with
"chore(release): ". The prepare job opens release pull requests with a
single commit and a title that are both "chore(release): vX.Y.Z", and the
repository squash-merges with COMMIT_OR_PR_TITLE, so the merge commit
always carries that prefix. Other VERSION changes skip the job, and a
skipped job is not a failure.

actionlint 1.7.12 passes.

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

* build(release): start versioning at 1.0.0 and release it as the first stable version

VERSION, package.json and package-lock.json move from 0.0.0 to 1.0.0
(set with `npm version 1.0.0 --no-git-tag-version`).

Until now, with no tag, `prepare` used VERSION as a baseline and always
went strictly above it, so 1.0.0 itself could never be released (the
next releases would have been 1.1.0 or 1.2.0). The new pure function
releaseVersion() in scripts/release/version.mts handles the first release:

- no tag, stable: the committed VERSION as is (it must have an even
  minor, otherwise prepare fails with an actionable message);
- no tag, pre-release: the next odd line, 1.0.0 -> 1.1.0;
- a tag exists: nextVersion() from it, unchanged.

prepare still requires at least one releasable (feat/fix/perf/revert or
breaking) commit. `npm version --allow-same-version` was already passed,
so keeping 1.0.0 unchanged works.

Docs: version examples in README, CONTRIBUTING, both changelog headers
and the bug report placeholder now use the 1.x line.

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

* feat(server): add an error-tolerant Lua 5.2 lexer and parser

Every planned language feature (symbols, folding, completion, hover,
navigation, rename, semantic tokens) needs a syntax tree with source
positions; the embedded official compiler only reports whether a chunk
compiles. This adds an original parser in src/server/syntax/ (pure: no
LSP or vscode imports), with no new dependency.

- lexer.ts follows lua-5.2.4/src/llex.c: ASCII names, the 22 reserved
  words, read_numeral (hex fractions and p exponents, malformed numbers),
  every 5.2 escape (\z, \x, \ddd, \ + line break), long brackets of any
  level, short and long comments kept apart from tokens. Offsets are
  document offsets, so chunks embedded in .menu files need no mapping.
- ast.ts: typed node unions for the whole Lua 5.2 grammar (manual §9),
  each with [start, end) offsets and the offsets of closing keywords.
- parser.ts: recursive descent mirroring lparser.c, with the official
  operator priorities, the `...`-outside-vararg and break-outside-loop
  checks, and the LUAI_MAXCCALLS nesting limit counted the same way as
  `enterlevel`. Error tolerant: it never throws, skips to the next
  statement after an error and keeps constructs whose closing keyword
  is missing, so features keep working while the user types. It
  publishes no diagnostics: the official compiler stays their only
  source. Not checked, by design: goto/label rules and code-generation
  limits (locals, upvalues, registers, constants).

Verification against the official Lua 5.2.4 compiler (the embedded
WebAssembly module):
- test/unit/server/syntax/differential.test.ts: a fixed corpus of 81
  accepted/rejected inputs, 4 seeds covering every statement and
  expression form, and 1,600 deterministic token mutations (1,401 of
  them rejected by the compiler); acceptance must match exactly.
- Locally, 99,338 first- and second-order mutations: 0 disagreements.
- Nesting limits match the compiler exactly (e.g. 198 parentheses, 200
  `do` blocks, 99 nested functions).
- The game's own UI.MENU (local only, never committed): 3,109 chunks,
  0 parse errors, same verdict as the compiler for each, 16 ms median
  to extract and parse all of them.

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

* feat(server): add Lua scope analysis

src/server/syntax/scope.ts resolves every identifier of a chunk to its
local declaration, or records it as a global, following the visibility
rules of the Lua 5.2 manual (§3.5):

- `local x = x`: the new local is visible only after the statement;
- `local function f`: visible in its own body (unlike `local f = function`);
- parameters and the implicit `self` of `function a:m()` in the body,
  `for` variables in the loop body (loop expressions are outside it);
- `repeat … until cond`: cond sees the body's locals;
- block scopes end at their closing keyword, shadowing resolves to the
  innermost declaration; only the first name of `function a.b.c()` and
  no table-constructor field name is a variable.

Document symbols use it to tell a global assignment from an assignment
to an existing local; go to definition, references and rename will use
the same declarations and references later. Pure module, unit-tested.

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

* feat(server): report the block structure of .menu files

The existing .menu scanner (extractMenuLua) now also returns `blocks`:
the nested `{ … }` tree, each with its keyword (`menu`, `button`, …),
the offsets of both braces, and its `name '…'` / `name "…"` property.
Extending the one scanner keeps a single definition of the menu syntax
(strings, `--` comments and backtick blocks hide their braces), so
symbols and folding see exactly what validation sees.

LuaChunk gains `origin` (`file`, `block` or `property`) so features can
treat `` `…` `` blocks differently from `action "…"` scripts. Chunks,
problems and diagnostics are unchanged; all existing tests pass as is.

Checked on the game's own UI.MENU (local only): 144 top-level blocks,
all `menu`, all named, 2,146 blocks in total, none unclosed, and every
nested keyword is an element type (button, label, text, list > column,
slot, edit, slider, template, handle, map, movie).

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

* feat(server): add document symbols

textDocument/documentSymbol for .lua and .menu files: the Outline view,
breadcrumbs and "Go to Symbol in Editor".

- src/server/syntax/document.ts: parseDocument() parses every Lua chunk
  of a document (reusing documentKind and extractMenuLua) and runs the
  scope analysis.
- src/server/documentCache.ts: parse results keyed by URI + version,
  shared by the features and dropped when the document closes
  (.claude/rules/language-server.md › Performance).
- src/server/syntax/symbols.ts (pure): functions and methods at any
  depth, nested under their enclosing function; locals declared by
  top-level statements; the first assignment to each global outside any
  function; named fields of table constructors. Assignments to existing
  locals, and locals inside blocks or functions, are left out so the
  outline shows definitions rather than every name. In .menu files each
  `menu` block is a Namespace named by its `name` property (the keyword
  when unnamed) holding the Lua symbols inside it; "…" scripts such as
  onOpen contribute functions only.
- src/server/features/documentSymbols.ts: hierarchical DocumentSymbol[]
  when the client announces hierarchicalDocumentSymbolSupport, otherwise
  flat SymbolInformation[] with container names (other editors). Honors
  the cancellation token, never throws (logs and returns null).
- Capability: documentSymbolProvider (label "IE Lua").

Tests: unit tests for symbols (including selection ⊆ range for every
symbol and symbols around syntax errors) and the cache; integration
tests with new original fixtures (outline.lua, OUTLINE.MENU) through
vscode.executeDocumentSymbolProvider, passing on VS Code 1.91.0 and
1.143.1.

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

* feat(server): add folding ranges

textDocument/foldingRange for .lua and .menu files.

Once a server provides folding ranges, VS Code uses them instead of
indentation and of the `{`/`}` folding markers of
language-configuration/ie-menu.json, so the ranges cover everything those
did, plus Lua structure:

- Lua: function bodies, do/while/for/repeat, each if/elseif/else clause,
  multi-line table constructors, parenthesized call arguments and long
  strings, long comments and runs of two or more `--` lines (kind
  comment);
- .menu: every `{ … }` block, `` `…` `` blocks, multi-line "…" scripts,
  and the Lua constructs inside them.

A construct folds to the line before its closing keyword, which stays
visible (`end`, `until`, `}`, `)`, the next `elseif`/`else`, a closing
`]]`, backtick or quote); comments fold entirely; a construct with a
missing closer folds to its last line. One range per start line (the
outermost). No region markers: VS Code's built-in Lua
language-configuration.json defines none (checked at the 1.91.0 tag),
so recognizing one would be an invention.

src/server/features/foldingRanges.ts honors `rangeLimit` (keeps the
first ranges), omits the comment kind when the client's valueSet lacks
it, returns whole-line ranges only (fine for `lineFoldingOnly`), checks
the cancellation token and never throws. Capability:
foldingRangeProvider.

The pure logic (src/server/syntax/folding.ts) is unit-tested with LSP
line numbering; integration tests use vscode.executeFoldingRangeProvider
(present in 1.91.0, checked in extHostApiCommands.ts at that tag) on the outline fixtures and pass on VS Code
1.91.0 and 1.143.1. On the game's own UI.MENU (26,101 lines, local only):
4,510 ranges in 5 ms, after a 26 ms parse that symbols reuse.

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

* docs: document symbols and folding

- README: the two new features, and the "early version" note.
- docs/editors/README.md: a "What you get" table with the LSP requests the
  server answers (diagnostics, document symbols, folding) for users of
  other editors, and that symbols and folding do not depend on
  validate.mode.
- CLAUDE.md (§1 purpose, §2 layout) and CONTRIBUTING (layout): the new
  src/server/syntax/ folder and its differential test.

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

* refactor(server): extract and unit-test the LSP conversions of symbols and folding

Found by the project /review: the code that adapts results to the
client was only exercised through VS Code, which always takes the
hierarchical symbol path and accepts every folding kind.

- toLspSymbols() (features/documentSymbols.ts): hierarchical
  DocumentSymbol[] or flat SymbolInformation[] with container names, the
  path that editors without hierarchicalDocumentSymbolSupport use.
- toLspFoldingRanges() (features/foldingRanges.ts): rangeLimit
  truncation (a negative limit counts as 0) and dropping the comment kind
  when the client's valueSet lacks it.

Both are pure and unit-tested in test/unit/server/features/; the
handlers keep only document lookup, cancellation and error logging.

The cache's `size` getter is now documented, and the folding integration
test sorts ranges numerically before formatting them.

No behavior change: 141 unit tests and 11 integration tests (VS Code
1.91.0 and 1.143.1) pass.

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

* ci: build the integration tests before running them, and fail empty runs

Found while checking the CI timings of this pull request: every
"Integration tests" job, on this branch and on main since #1, logged
`0 passing (0ms)` and succeeded. ci.yml calls `npx vscode-test --label`
directly to pick one VS Code version, which skips npm's `pretest` script
(`node esbuild.mjs --tests`), so out/test/integration/ never existed and
the test glob matched nothing. The suites passed only locally, where
`npm test` runs pretest.

- ci.yml: a "Build extension and integration tests" step runs
  `npm run pretest` before vscode-test (same command as `npm test`).
- .vscode-test.mjs: mocha `failZero: true` (mocha 11.8.0, used by
  @vscode/test-cli, applies it from mochaOpts), so a run without tests
  fails. Verified locally: without the build, `vscode-test --label
  minimum` now ends with "1 test failed." and exit code 1 (before: 0
  passing, exit 0); with it, 11 passing.
- .mocharc.json: `fail-zero` for the unit tests as well (mocha 12
  already fails when no file matches; this covers matching files with
  no tests: exit 1 instead of 0, verified with an empty test file).

actionlint 1.7.12 passes. The integration jobs will take a few seconds
longer for the build and for actually running the 11 tests.

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.

2 participants