Skip to content

fix: IDE completion no longer wraps allowed keyword identifiers in backticks - #11426

Merged
Timothee Guerin (timotheeguerin) merged 2 commits into
mainfrom
copilot/fix-ide-completion-keywords
Jul 28, 2026
Merged

fix: IDE completion no longer wraps allowed keyword identifiers in backticks#11426
Timothee Guerin (timotheeguerin) merged 2 commits into
mainfrom
copilot/fix-ide-completion-keywords

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

When completing keyword identifiers (e.g. auto, internal, extern) in positions where they are valid without escaping — model property names, object literal properties, and member expressions — the language server was incorrectly inserting backtick-quoted completions.

model Test { auto: string }

// Completing `Test.au|` produced: Test.`auto`  ❌
// Should produce:                 Test.auto     ✅

model Child extends Base {
  // Completing `au|` produced: `auto`  ❌
  // Should produce:             auto   ✅
}

Changes

  • completion.ts — Added getIdentifierPrintContext() helper that returns "allow-reserved" when the identifier node's parent is a MemberExpression, ModelProperty, or ObjectLiteralProperty, and "disallow-reserved" otherwise. Updated addIdentifierCompletion to pass this context to printIdentifier instead of always using the default ("disallow-reserved").

  • completion.test.ts — Two new tests covering keyword completion without backticks in member expression and model body contexts.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

…positions

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix IDE completion to avoid wrapping keywords in quotes fix: IDE completion no longer wraps allowed keyword identifiers in backticks Jul 28, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label Jul 28, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@11426

commit: 50c5d36

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Merged via the queue into main with commit 39cc929 Jul 28, 2026
33 checks passed
@timotheeguerin
Timothee Guerin (timotheeguerin) deleted the copilot/fix-ide-completion-keywords branch July 28, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ide completion still add backtick when completing the reserved keyword in place they are allowed

3 participants