Skip to content

Escape quotes in synthesized module specifiers - #64839

Merged
Ryan Cavanaugh (RyanCavanaugh) merged 1 commit into
microsoft:mainfrom
RyanCavanaugh:escapeModuleSpecifiers
Oct 15, 2026
Merged

Ryan Cavanaugh (RyanCavanaugh) merged 1 commit into
microsoft:mainfrom
RyanCavanaugh:escapeModuleSpecifiers

Conversation

@RyanCavanaugh

Copy link
Copy Markdown
Member

Fixes cases where package.json could have a module specifier that closed the import name, making the importing file syntactically invalid or unexpected:

import * as foo from "uneescaped"string";

I am not attached to this generated testcase, it's not great, but does do the job. Open to changing it to a matrix of single cases if anyone cares.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 23:03
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 15, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 15, 2026
@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Oct 15, 2026

Copilot AI 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.

🟢 Approval recommended

Static review identified no blocking issues in the localized escaping changes and accompanying regression tests.

0 open findings

What changed in this PR

Fixes quote escaping in synthesized module specifiers so language-server import suggestions remain valid.

Changes:

  • Applies snippet escaping only to snippet completions, preserving literal backslashes.
  • Escapes module specifiers in JSDoc import types.
  • Adds regression tests covering quote preferences, import fixes, and completions.
File Description
tsc/​internal/​ls/​completions.go Separates string quoting from snippet escaping.
tsc/​internal/​ls/​autoimport/​fix.go Escapes quoted JSDoc import specifiers.
tsc/​internal/​fourslash/​tests/​autoImportQuotedModuleSpecifier_test.go Tests quoted specifiers across import workflows.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Merged via the queue into microsoft:main with commit 0e081d6 Oct 15, 2026
29 checks passed
@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) deleted the escapeModuleSpecifiers branch October 15, 2026 23:36
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants