From 1614bd1eed2cec8aeedb59b9214dbe5adbfe7409 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Sun, 26 Apr 2020 22:02:16 +0100 Subject: [PATCH] add languages --- packages/tailwindcss-vscode/src/extension.ts | 9 +++-- .../tailwindcss-vscode/src/lib/languages.ts | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 packages/tailwindcss-vscode/src/lib/languages.ts diff --git a/packages/tailwindcss-vscode/src/extension.ts b/packages/tailwindcss-vscode/src/extension.ts index e27a99c..7005528 100755 --- a/packages/tailwindcss-vscode/src/extension.ts +++ b/packages/tailwindcss-vscode/src/extension.ts @@ -18,12 +18,11 @@ import { TransportKind, } from 'vscode-languageclient' import { registerConfigErrorHandler } from './lib/registerConfigErrorHandler' +import { LANGUAGES } from './lib/languages' let defaultClient: LanguageClient let clients: Map = new Map() -const LANGS = ['css', 'javascript', 'html', 'vue', 'svelte'] - let _sortedWorkspaceFolders: string[] | undefined function sortedWorkspaceFolders(): string[] { if (_sortedWorkspaceFolders === void 0) { @@ -72,7 +71,7 @@ export function activate(context: ExtensionContext) { function didOpenTextDocument(document: TextDocument): void { // We are only interested in language mode text if ( - LANGS.indexOf(document.languageId) === -1 || + LANGUAGES.indexOf(document.languageId) === -1 || (document.uri.scheme !== 'file' && document.uri.scheme !== 'untitled') ) { return @@ -87,7 +86,7 @@ export function activate(context: ExtensionContext) { debug: { module, transport: TransportKind.ipc, options: debugOptions }, } let clientOptions: LanguageClientOptions = { - documentSelector: LANGS.map((language) => ({ + documentSelector: LANGUAGES.map((language) => ({ scheme: 'untitled', language, })), @@ -121,7 +120,7 @@ export function activate(context: ExtensionContext) { debug: { module, transport: TransportKind.ipc, options: debugOptions }, } let clientOptions: LanguageClientOptions = { - documentSelector: LANGS.map((language) => ({ + documentSelector: LANGUAGES.map((language) => ({ scheme: 'file', language, pattern: `${folder.uri.fsPath}/**/*`, diff --git a/packages/tailwindcss-vscode/src/lib/languages.ts b/packages/tailwindcss-vscode/src/lib/languages.ts new file mode 100644 index 0000000..e2e7b72 --- /dev/null +++ b/packages/tailwindcss-vscode/src/lib/languages.ts @@ -0,0 +1,36 @@ +export const LANGUAGES = [ + // html + 'blade', + 'django-html', + 'edge', + 'ejs', + 'erb', + 'haml', + 'handlebars', + 'html', + 'HTML (Eex)', + 'jade', + 'leaf', + 'markdown', + 'njk', + 'nunjucks', + 'php', + 'razor', + 'slim', + 'twig', + // css + 'css', + 'less', + 'postcss', + 'sass', + 'scss', + 'stylus', + // js + 'javascript', + 'javascriptreact', + 'reason', + 'typescriptreact', + // mixed + 'vue', + 'svelte', +]