Skip to content

Commit

Permalink
fix: support cts/mts extensions (#2926)
Browse files Browse the repository at this point in the history
Resolves #2855
  • Loading branch information
elijaholmos authored Dec 1, 2022
1 parent 6c3ca90 commit 10e97bb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/heavy-dancers-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'graphql-language-service-server': patch
'vscode-graphql': patch
'vscode-graphql-syntax': patch
---

support cts and mts file extensions
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function findGraphQLTags(
parsedASTs.push(...parseVueSFCResult.scriptSetupAst);
}
} else {
const isTypeScript = ext === '.ts' || ext === '.tsx';
const isTypeScript = ['.ts', '.tsx', '.cts', '.mts'].includes(ext);
if (isTypeScript) {
plugins?.push('typescript');
} else {
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql-language-service-server/src/parseDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const DEFAULT_SUPPORTED_EXTENSIONS = [
'.tsx',
'.vue',
'.svelte',
'.cts',
'.mts',
];

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/vscode-graphql-syntax/grammars/graphql.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"ts",
"tsx",
"vue",
"svelte"
"svelte",
"cts",
"mts"
],
"injectionSelector": "L:source -string -comment",
"patterns": [
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-graphql/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function activate(context: ExtensionContext) {
// TODO: load ignore
// These ignore node_modules and .git by default
workspace.createFileSystemWatcher(
'**/{*.graphql,*.graphqls,*.gql,*.js,*.mjs,*.cjs,*.esm,*.es,*.es6,*.jsx,*.ts,*.tsx,*.vue,*.svelte}',
'**/{*.graphql,*.graphqls,*.gql,*.js,*.mjs,*.cjs,*.esm,*.es,*.es6,*.jsx,*.ts,*.tsx,*.vue,*.svelte,*.cts,*.mts}',
),
],
},
Expand Down

0 comments on commit 10e97bb

Please sign in to comment.