Skip to content

feat: add mcfunction inlay hint support to LSP server#500

Merged
DaanV2 merged 7 commits into
mainfrom
copilot/add-support-for-inlay-hints
May 15, 2026
Merged

feat: add mcfunction inlay hint support to LSP server#500
DaanV2 merged 7 commits into
mainfrom
copilot/add-support-for-inlay-hints

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

This change adds first-class inlay hint support to the language server, focused on .mcfunction command arguments. The server now returns parameter-name hints for command inputs (including active subcommands in execute chains), improving readability of dense command lines.

  • LSP capability + request handling

    • Added a new InlayHintService and registered it in server setup.
    • Advertises inlayHintProvider in initialize capabilities.
    • Wires textDocument/inlayHint via connection.languages.inlayHint.on(...).
  • mcfunction hint generation

    • Parses each requested line as a command and resolves active subcommand context.
    • Maps parsed arguments to best-match command metadata and emits InlayHintKind.Parameter labels.
    • Excludes non-argument tokens (keyword, command, executeSubcommand) to avoid noisy hints.
    • Ignores empty/comment lines and returns hints only inside the requested range.
  • Focused inlay-hint behavior coverage

    • Added unit coverage for:
      • basic argument hints (say hello world)
      • nested/execute subcommand hints
      • filtering of non-argument tokens
      • empty-input behavior
// Service registration
this.addDisposable(connection.languages.inlayHint.on(this.onInlayHint.bind(this)));

// Emitted hint shape
{
  kind: InlayHintKind.Parameter,
  label: `${hint.label}:`,
  paddingRight: true,
  position,
}

@DaanV2 DaanV2 marked this pull request as ready for review May 15, 2026 20:05
@DaanV2 DaanV2 changed the title Add mcfunction inlay hint support to LSP server feat: add mcfunction inlay hint support to LSP server May 15, 2026
@DaanV2 DaanV2 merged commit a07edb5 into main May 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants