Skip to content

Use native file type mappings for TypeScript-side classification - #14711

Draft
Colen Garoutte-Carson (Colengms) wants to merge 2 commits into
mainfrom
dev/coleng/file_mappings
Draft

Use native file type mappings for TypeScript-side classification#14711
Colen Garoutte-Carson (Colengms) wants to merge 2 commits into
mainfrom
dev/coleng/file_mappings

Conversation

@Colengms

@Colengms Colen Garoutte-Carson (Colengms) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Use the effective mappings published by the native language server as the primary source of truth for TypeScript file classification.

This prevents hardcoded extension lists from drifting from native behavior and avoids forwarding changes for non-C/C++ files to the browse database.

package.json only augments VS Code’s language-association registry. VS Code’s built-in C++ language contribution already registers the standard extensions, so this package need only add associations that are missing or that cpptools wants to guarantee independently.

Changes

  • Add an atomic file type registry for extension and exact-filename mappings.
  • Retain bootstrap defaults for startup and compatibility with older native binaries.
  • Prefer exact filename mappings over extension mappings.
  • Support native extensionless headers and newly recognized extensions such as .cppm.
  • Preserve the existing uppercase .C compatibility behavior.
  • Use the active document language for otherwise unregistered paths.
  • Route common source/header predicates, build/debug checks, and file-watcher filtering through the registry.
  • Refresh active-file state and invalidate cached build tasks when mappings change.
  • Add focused tests for bootstrap behavior, native replacement, exact mappings, extensionless headers, watcher classification, and language fallback.

Validation

  • yarn compile
  • 3 focused Mocha tests
  • Focused ESLint
  • git diff --check

Depends on the corresponding native protocol PR. The extension remains compatible with older native binaries through its bootstrap mappings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

1 participant