add languages

master
Brad Cornes 2020-04-26 22:02:16 +01:00
parent c69e210f7d
commit 1614bd1eed
2 changed files with 40 additions and 5 deletions

View File

@ -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<string, LanguageClient> = 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}/**/*`,

View File

@ -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',
]