Conversation
The bridge's completion provider sent only the document and position, so the server could not tell a typed trigger character from an explicit invocation. The VS Code client sends that context; the Monaco bridge now does too, mapping Monaco's zero-based trigger kinds onto LSP's one-based ones.
The server opened completion on ':', ',', '{', '[' and every newline,
where the next keystroke is often Enter: an object conventionally nests
on the line after `key:`, and brackets and commas open multi-line
structure. With the popup open, Enter accepted a suggestion instead.
Declare '"', "'", '\n' and ' ' as triggers, and answer the whitespace
ones only at an empty slot: after ':', ',', '{' or '[', with the rest
of the line blank but for auto-closed closing brackets. So `status: `
lists its enum values, `server:` then Enter breaks the line and offers
the nested properties on the fresh line, and spacing out `status:active`
stays quiet. Requests without a completion context are always answered.
Known gaps: a trailing comment after `key:` suppresses the popup, and
a delimiter inside a comment or quoted string, most often a comma and
space in comment prose, can still open it. Both belong in the tooling,
which knows token context.
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.
The language server asked editors to open completion on
:,,,{,[and every newline. Those are exactly the spots where the next keystroke is often Enter: an object conventionally nests on the line afterkey:, and brackets and commas open multi-line structure. With the popup already open, Enter accepted the first suggestion instead of inserting the newline.What changed
The server now declares
",', newline and space as trigger characters, and answers the whitespace ones only at an empty slot: after:,,,{or[, with the rest of the line blank apart from auto-closed brackets. In practice:Prior art
The YAML language server declares no trigger characters and relies on editor quick suggestions. VS Code's JSON server declares
"and:; the colon suits JSON, where the value follows on the same line, but not KSON. TypeScript declares space and decides server-side, which is the pattern used here.Known gaps
key:suppresses the popup on the next line.