Skip to content

Improve completion triggering + add parameter hints (signature help)#1234

Merged
kishikawakatsumi merged 3 commits into
masterfrom
feature/completion-and-signature-help
Jun 11, 2026
Merged

Improve completion triggering + add parameter hints (signature help)#1234
kishikawakatsumi merged 3 commits into
masterfrom
feature/completion-and-signature-help

Conversation

@kishikawakatsumi

Copy link
Copy Markdown
Member

Makes code completion behave more like Xcode and adds parameter hints.

Completion triggering

Previously completion only auto-triggered after ., and the editor never configured Monaco's suggestion options, so it felt unpredictable.

  • Editor options (main_view.js): quickSuggestions on for code, quickSuggestionsDelay: 0, suggestOnTriggerCharacters, tabCompletion: "on" — suggestions now pop up while typing.
  • More trigger characters (editor.js): . ( : < space ,.
  • Ctrl+Space explicitly bound to editor.action.triggerSuggest (Cmd+Space is Spotlight on macOS, so Control is used) — Xcode-style manual trigger.

Parameter hints (signature help)

  • Registers a Monaco registerSignatureHelpProvider (triggers on ( and ,).
  • requestSignatureHelp() sends a new signatureHelp method; the response maps to Monaco's SignatureHelp (signatures / parameters / activeParameter), so the active argument is highlighted as you type.

Bug fix

The completion case in the response handler was missing a break and fell through into diagnostics, clearing the editor's diagnostic markers on every completion request. Added the break.

Notes

🤖 Generated with Claude Code

Completion previously only auto-triggered after "." and relied on Monaco
defaults that weren't configured. Make it behave more like Xcode:

- Editor options: quickSuggestions on (code), quickSuggestionsDelay 0,
  suggestOnTriggerCharacters, tabCompletion — so suggestions pop while typing.
- More completion trigger characters: "(", ":", "<", " ", "," in addition to ".".
- Explicit Ctrl+Space action bound to editor.action.triggerSuggest (Cmd+Space
  is taken by Spotlight on macOS, so bind Control).

Add Signature Help (parameter hints):

- Register a Monaco signatureHelpProvider (trigger on "(" and ",").
- New requestSignatureHelp() sends the `signatureHelp` method to the backend
  and the response is mapped to Monaco's SignatureHelp shape.

Also fix a pre-existing bug: the `completion` case in the response handler was
missing a `break` and fell through into `diagnostics`, clearing the diagnostic
markers on every completion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 11, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Monaco-based Swift editor to make completion trigger more predictably (more like Xcode) and adds signature help (parameter hints) via a new backend signatureHelp request.

Changes:

  • Enable Monaco suggestion options (quick suggestions, no delay, trigger characters, Tab completion).
  • Expand completion trigger characters and add an explicit Ctrl+Space action to manually trigger suggestions.
  • Add a signature help provider wired through the web language server client and response handler (including fixing a completion fall-through bug via a missing break).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
Public/js/main_view.js Enables Monaco suggestion behavior (quick suggestions, delay, trigger characters, Tab completion).
Public/js/language_server.js Adds a requestSignatureHelp request method to the WS language-server protocol client.
Public/js/editor.js Expands completion triggers, registers a signature help provider, and binds Ctrl+Space to trigger suggest.
Public/js/app.js Handles signatureHelp responses and wires editor signature help requests; adds missing break after completion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Public/js/app.js
Comment on lines 118 to +121
} else {
promise.fulfill();
}
break;
Comment thread Public/js/app.js
Comment on lines +148 to +151
} else {
promise.fulfill();
}
break;
Comment thread Public/js/editor.js
Comment on lines 38 to 41
monaco.languages.registerCompletionItemProvider("swift", {
triggerCharacters: ["."],
triggerCharacters: [".", "(", ":", "<", " ", ","],
provideCompletionItems: (model, position) => {
return this.oncompletion(position);
kishikawakatsumi and others added 2 commits June 12, 2026 05:02
`promises` is keyed by an ever-incrementing sequence and nothing removed
entries, so it grew unbounded — now worse since completion fires on every
keystroke (quick suggestions + more trigger characters) and signature help
fires inside calls. Delete the entry right after retrieving it in onresponse,
covering hover/completion/signatureHelp at once (no-op for diagnostics/format).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A literal space triggered the completion provider (and a backend request) on
every whitespace keystroke — very frequent and returning a large, unfiltered
list. quickSuggestions already shows suggestions once the next identifier is
typed, so the space trigger only added wasteful traffic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kishikawakatsumi kishikawakatsumi merged commit 00211e9 into master Jun 11, 2026
1 check passed
@kishikawakatsumi kishikawakatsumi deleted the feature/completion-and-signature-help branch June 11, 2026 20:33
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