-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use typescript for the VS Code language config
- Loading branch information
1 parent
4449e9c
commit 9c32ec9
Showing
15 changed files
with
127 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/vscode-extension/scripts/language-configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { LanguageConfiguration } from 'vscode'; | ||
import { indentationRules, IndentationRulesJSON } from './indentation-rules'; | ||
import { onEnterRules, OnEnterRuleJSON } from './on-enter-actions'; | ||
|
||
// interface LanguageConfigurationJSON | ||
// extends Omit<LanguageConfiguration, 'onEnterRules' | 'indentationRules'> { | ||
// onEnterRules?: OnEnterRuleJSON[]; | ||
// indentationRules?: IndentationRulesJSON; | ||
// } | ||
|
||
export async function makeConfig(): Promise<any> { | ||
return { | ||
comments: { | ||
blockComment: ['{% comment %}', '{% endcomment %}'], | ||
}, | ||
brackets: [ | ||
['<', '>'], | ||
['{{-', '-}}'], | ||
['{{-', '}}'], | ||
['{{', '-}}'], | ||
['{{', '}}'], | ||
['{%-', '-%}'], | ||
['{%-', '%}'], | ||
['{%', '-%}'], | ||
['{%', '%}'], | ||
['[', ']'], | ||
['(', ')'], | ||
], | ||
autoClosingPairs: [ | ||
['{', '}'], | ||
['{{', '}}'], | ||
['{%', '%}'], | ||
['[', ']'], | ||
['(', ')'], | ||
['"', '"'], | ||
["'", "'"], | ||
['<', '>'], | ||
], | ||
autoCloseBefore: '%-:.,=}])>\'"` \n\t', | ||
surroundingPairs: [ | ||
['-', '-'], | ||
['<', '>'], | ||
['{', '}'], | ||
['[', ']'], | ||
['(', ')'], | ||
["'", "'"], | ||
['"', '"'], | ||
['`', '`'], | ||
], | ||
onEnterRules: await onEnterRules(), | ||
indentationRules: await indentationRules(), | ||
}; | ||
} |
4 changes: 0 additions & 4 deletions
4
packages/vscode-extension/scripts/make-language-configuration
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/vscode-extension/scripts/make-language-configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env ts-node | ||
import { makeConfig } from './language-configuration'; | ||
import * as fs from 'fs/promises'; | ||
|
||
async function main() { | ||
try { | ||
await fs.writeFile( | ||
'./language-configuration.json', | ||
JSON.stringify(await makeConfig(), null, 2), | ||
'utf8', | ||
); | ||
} catch (_) { | ||
process.exit(1); | ||
} | ||
|
||
process.exit(0); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { EnterAction, OnEnterRule } from 'vscode'; | ||
|
||
export interface OnEnterRuleJSON extends Omit<OnEnterRule, 'action'> { | ||
action: EnterActionJSON; | ||
} | ||
|
||
export interface EnterActionJSON extends Omit<EnterAction, 'indentAction'> { | ||
indent: 'indent' | 'indentOutdent' | 'outdent' | 'none'; | ||
} | ||
|
||
export async function onEnterRules(): Promise<OnEnterRuleJSON[]> { | ||
return []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"noEmit": true, | ||
"rootDir": "../../..", | ||
"resolveJsonModule": true, | ||
"composite": true, | ||
"declarationDir": "/tmp/vscode-extension-useless-declarations", | ||
"paths": { | ||
"@shopify/theme-check-docs-updater": ["../../theme-check-docs-updater/src"] | ||
} | ||
}, | ||
"include": ["**/*.ts"], | ||
"references": [ | ||
{ "path": "../../theme-check-docs-updater/tsconfig.build.json" } | ||
] | ||
} |
27 changes: 0 additions & 27 deletions
27
packages/vscode-extension/scripts/watch-language-configuration
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters