Skip to content

Skip TypeScript activation and patching for GJS/GTS projects without tsconfig/jsconfig#1076

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/prevent-ts-activation-without-config
Closed

Skip TypeScript activation and patching for GJS/GTS projects without tsconfig/jsconfig#1076
Copilot wants to merge 2 commits intomainfrom
copilot/prevent-ts-activation-without-config

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 12, 2026

JS/GJS projects without a tsconfig.json or jsconfig.json were receiving spurious TypeScript errors (ts-plugin(1128): Declaration or statement expected) because the extension unconditionally patched the TS extension to treat .gjs/.gts as TypeScript-like languages — causing the raw TS parser to choke on <template> syntax with no Glint server running to handle it.

Changes (packages/vscode/src/extension.ts)

  • TS extension activation — gate tsExtension.activate() behind hasWorkspaceConfig so TypeScript never activates for config-less GJS projects
  • TS extension patching — gate the jsTsLanguageModes / isSupportedLanguageMode monkey-patch behind the same hasWorkspaceConfig check, preventing .gjs/.gts from being registered as TS-like language modes
  • configureTsserverPlugin — early-return when no config file is found, eliminating the noise log lines (typescript.configurePlugin not available, Workspace ember-tsc not found) that appeared even when Glint had already correctly skipped activation
const patchWorkspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
const hasWorkspaceConfig = patchWorkspaceRoot
  ? !!findConfigFileInWorkspace(patchWorkspaceRoot)
  : false;

if (tsExtension && hasWorkspaceConfig) { /* activate */ }
if (!v1ExtensionPresent && hasWorkspaceConfig) { /* patch */ }

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…nfig/jsconfig

For JS/GJS projects without a tsconfig.json or jsconfig.json, the Glint
extension was incorrectly:
1. Activating the TypeScript extension
2. Patching it to treat .gjs/.gts as TypeScript-like languages
3. Running configureTsserverPlugin() which logged confusing messages

This caused the raw TypeScript parser to try parsing <template> tags in
.gjs files, resulting in spurious 'Declaration or statement expected'
errors (ts-plugin 1128).

Fixes: only activate/patch TypeScript and configure tsserver plugin when
findConfigFileInWorkspace() confirms a tsconfig.json/jsconfig.json exists.

Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeScript activation for JS/GJS projects Skip TypeScript activation and patching for GJS/GTS projects without tsconfig/jsconfig Mar 12, 2026
Copilot AI requested a review from NullVoxPopuli March 12, 2026 18:29
@ef4
Copy link
Copy Markdown
Contributor

ef4 commented Apr 13, 2026

Is this superseded?

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

yup

@NullVoxPopuli NullVoxPopuli deleted the copilot/prevent-ts-activation-without-config branch April 13, 2026 15:57
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.

3 participants