Skip to content

feat(editor): annotation typing, callback highlighting and quote-aware snippets - #5

Merged
ChatDisabled merged 8 commits into
Qbox-project:mainfrom
loaf-scripts:main
Sep 30, 2026
Merged

ChatDisabled merged 8 commits into
Qbox-project:mainfrom
loaf-scripts:main

Conversation

@loaf-scripts

Copy link
Copy Markdown
Contributor

Changes

The VS Code side of the language server work in Qbox-project/qbx-lua#12. Only the VS Code extension changes.

Typing annotations

  • editor.formatOnType is on for Lua by default. The server continues ---@ annotation lines on Enter through on-type formatting, which VS Code only runs with that setting.
  • Typing the first letter after ---@ opens the tag list. VS Code does not suggest while typing in comments, so the list only appeared on Ctrl+Space before. It stays closed on a bare ---@, so Enter there still clears the line.
  • editor.suggest.preview is on for Lua by default, so the rest of the selected suggestion shows in gray at the cursor.

Suggestions after a completion

The client lists editor.action.triggerSuggest under experimental.commands.commands. The server then attaches it to the call snippets of ---@callback wrappers and of functions whose parameter lists string values, so the names or values are suggested as soon as the call is inserted.

Highlighting

A grammar injection into --- comments colors what VS Code's Lua grammar leaves plain: the role and family of ---@callback register shop, attribute lists such as (exact, server), and the visibility keyword of @field.

Quotes

The fxmanifest and config module snippets, the snippet browser's manifest recipes and the resource wizard's new fxmanifest.lua are written in the quote the server reports through qbx/quote: the formatter's quote_style, or else the quote most strings of the document use. Without a running server they keep single quotes.

The snippets now come from a completion provider instead of a snippets contribution, so VS Code's Insert Snippet list no longer shows them. The snippet browser still does.

Other

  • The description of qbxLua.diagnostics.rules and the README now say that the levels a qbxlint.toml sets take precedence, which is what the server does after the qbx-lua change.
  • The snippet test retries its temp-folder cleanup, which failed with EBUSY on Windows while the built-in Git extension held the folder.

Things that change for users

Two editor defaults change for Lua files: editor.formatOnType and editor.suggest.preview. Both can be turned off in user settings.

These features need a server that includes the qbx-lua pull request, so this should be released after it.

Checks

  • npm run typecheck and npm test pass on Windows (165 tests), with the server built from the qbx-lua branch. Not run on Linux or macOS.
  • New tests cover the Enter continuation, the tag list after ---@, the highlighting injection, reopening suggestions after a wrapper snippet, and the quote used by manifest snippets and the resource wizard.
  • npm run package was not run.

🤖 Generated with Claude Code

The language server continues `---@` annotation lines on Enter through
on-type formatting, which VS Code only runs with editor.formatOnType. Turn it
on for Lua by default and cover the continuation and clearing in the
extension tests.
List editor.action.triggerSuggest under the client's
experimental.commands.commands capability, the way rust-analyzer's client
lists the commands it runs. The language server then attaches it to call
snippets of ---@callback await and trigger wrappers, so the registered
callback names are suggested as soon as the call is inserted.
VS Code's Lua grammar scopes `---` comments as
comment.line.double-dash.documentation.lua and colors the tags it knows. A
new injection into those comments adds what it leaves plain: the role and
family of `---@callback register shop`, attribute lists such as
`(exact, server)` after @Class, @alias, @enum, @field and @overload, and
the visibility keyword of @field, which the built-in rule read as the field
name. The rest of each line keeps the built-in colors.
Turn on editor.suggest.preview for Lua by default, so the rest of the
selected completion shows in gray at the cursor, e.g. `---@p` previews
`aram`, and Tab accepts it.
VS Code does not suggest while typing in comments, so the `---@` that Enter
adds to an annotation block showed no tags until Ctrl+Space. The extension
now opens the tag list when the first letter is typed after `---@`. The list
does not open on the bare `---@` itself, so Enter there still clears it.
Showing an editor for a file outside any repository makes the built-in
Git extension run `git rev-parse --show-toplevel` in that file's folder.
On Windows a running process's working directory cannot be removed, so
the snippet test that opens the personal library and cleans up right
away failed with EBUSY on rmdir 'profile'. Retry the removal briefly.
The fxmanifest and config module snippets were a static snippets
contribution, always written with single quotes. A completion provider
now offers them under the same prefixes, in the quote the language server
reports through qbx/quote: the formatter's quote_style, or else the quote
most strings of the document use. The snippet browser shows its manifest
recipes the same way, and the resource wizard writes the new
fxmanifest.lua in the configured quote, `'` when it is preserve. Without
a running server, all of them keep single quotes.

As they are no longer contributed snippets, VS Code's Insert Snippet list
leaves them out; the snippet browser still lists them.
…rules

The language server now keeps the rule levels a `qbxlint.toml` sets, and
`qbxLua.diagnostics.rules` only sets the level of the remaining rules.
The setting's description and the README said it overrides rule levels.
@ChatDisabled
ChatDisabled merged commit 6efabf4 into Qbox-project:main Sep 30, 2026
5 of 6 checks passed
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