Skip to content

fix: honor completion snippet support capability - #1346

Open
Shubham-Padkonde wants to merge 3 commits into
redhat-developer:mainfrom
Shubham-Padkonde:fix/completion-snippet-capability
Open

Shubham-Padkonde wants to merge 3 commits into
redhat-developer:mainfrom
Shubham-Padkonde:fix/completion-snippet-capability

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 17, 2026 •

Copy link
Copy Markdown

What does this PR do?

Honor textDocument.completion.completionItem.snippetSupport. When it is missing or false, generate plain-text completions using schema defaults without tab stops or snippet escaping. Preserve literal dollar signs. Snippet-capable clients retain placeholders and choices, and schema defaultSnippets remain limited to those clients.

Expose the capability in the public type and LATEST constant and document the behavior. Following review, generate plain text at insertion points; no vscode-snippet-parser dependency is added.

The latest update merges main 7e8061c, preserving its nullable-string-default fix and adapting the capability tests to ESM and node:test. Four added cases cover required nullable defaults with snippet support both enabled and disabled.

What issues does this PR fix or reference?

Fixes #161.

Is it tested? How?

At 0265353, on Windows / Node 24.15.0 / npm 12.0.2:

  • npm run build: passes clean, ESLint and TypeScript compilation.
  • npm test: 1,407 passed, one skipped, zero failed across 306 suites, including all 18 capability regressions and upstream nullable-default cases.
  • git diff --check: passes; the merge has no unresolved paths.

This is the full repository test command on Windows. No editor-integration run or local macOS/Linux matrix is claimed. Hosted checks for the new commit are separate and must still complete.

AI assistance: Codex prepared the implementation/review follow-ups, conflict recovery, tests and this description. The contributor personally reviewed this recovery update and certified the DCO before publication; no personal execution of the automated tests is claimed.

Assisted-by: Codex/GPT-6
Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>

@datho7561 datho7561 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like vscode-snippet-parser is unmaintained (no commits in 9 years). Also, it's not published by the VS Code team, but a seemingly by unmaintained project called onivim. As a result, I don't like adding it as a dependency.

I think this approach in general isn't great, since it's removing the tab stops after the fact rather than avoiding putting them in in the first place. I think the implementation could be much simpler if we wrapped each time we add a tab stop with an if/else. It seems like all the tab stops are added in getInsertTextForGuessedValue or getInsertTextForProperty. Also, we have the helper method this.evaluateTab1Symbol available that can be used to substitute the tab stop with the default value assigned for the tab stop if we want to go the route of pre-evaluating each tab stop.

@Shubham-Padkonde

Shubham-Padkonde commented Nov 3, 2026 •

Copy link
Copy Markdown
Author

Updated this branch at 0265353 against main 7e8061c, retaining the upstream nullable-string-default fix alongside capability-aware plain-text completion. The capability tests now use the current ESM/node:test setup, with four additional cases covering nullable defaults with snippet support enabled and disabled.

Validation on Windows / Node 24.15.0: npm run build passes (ESLint and TypeScript); the full npm test run reports 1,407 passing, one skipped, zero failures. No editor-integration or macOS/Linux run is claimed.

The earlier request to remove vscode-snippet-parser remains addressed: no parser dependency is added, and placeholders are controlled where they are generated. This recovery and validation were prepared with Codex assistance.

CI update: run 41615294245 is awaiting maintainer approval for 0265353; no jobs have started. Could a maintainer approve that run when reviewing this update?

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.

Server returns snippets even though client doesn't support them

2 participants