Skip to content

Commit

Permalink
feat: add svelte sfc support (#17)
Browse files Browse the repository at this point in the history
* feat: add svelte sfc support

* Merge 'svelte' into existing `extractGraphQLDocumentsFromJSTemplateLiterals` case

* Fix spacing

Co-authored-by: Jason Zukewich <jason@apollographql.com>
  • Loading branch information
alexanderniebuhr and Jason Zukewich committed Sep 7, 2021
1 parent 61a0d69 commit 45605f0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -137,7 +137,8 @@
"source.ts",
"source.js.jsx",
"source.tsx",
"source.vue"
"source.vue",
"source.svelte"
],
"scopeName": "inline.graphql",
"path": "./syntaxes/graphql.js.json",
Expand Down
1 change: 1 addition & 0 deletions src/language-server/document.ts
Expand Up @@ -65,6 +65,7 @@ export function extractGraphQLDocuments(
case "typescript":
case "typescriptreact":
case "vue":
case "svelte":
return extractGraphQLDocumentsFromJSTemplateLiterals(document, tagName);
case "python":
return extractGraphQLDocumentsFromPythonStrings(document, tagName);
Expand Down
1 change: 1 addition & 0 deletions src/language-server/project/base.ts
Expand Up @@ -50,6 +50,7 @@ const fileAssociations: { [extension: string]: string } = {
".jsx": "javascriptreact",
".tsx": "typescriptreact",
".vue": "vue",
".svelte": "svelte",
".py": "python",
".rb": "ruby",
".dart": "dart",
Expand Down
3 changes: 2 additions & 1 deletion src/languageServerClient.ts
Expand Up @@ -47,6 +47,7 @@ export function getLanguageServerClient(
"javascriptreact",
"typescriptreact",
"vue",
"svelte",
"python",
"ruby",
"dart",
Expand All @@ -57,7 +58,7 @@ export function getLanguageServerClient(
fileEvents: [
workspace.createFileSystemWatcher("**/.env?(.local)"),
workspace.createFileSystemWatcher(
"**/*.{graphql,js,ts,jsx,tsx,vue,py,rb,dart,re,ex,exs}"
"**/*.{graphql,js,ts,jsx,tsx,vue,svelte,py,rb,dart,re,ex,exs}"
),
],
},
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/graphql.js.json
@@ -1,5 +1,5 @@
{
"fileTypes": ["js", "jsx", "ts", "tsx", "vue"],
"fileTypes": ["js", "jsx", "ts", "tsx", "vue", "svelte"],
"injectionSelector": "L:source -string -comment",
"patterns": [
{
Expand Down

0 comments on commit 45605f0

Please sign in to comment.