Skip to content

Commit 7accd8a

Browse files
committed
Only process XML documents with the schemes 'file' and 'untitled'
Fixes #861 Signed-off-by: David Thompson <[email protected]>
1 parent efd52ad commit 7accd8a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/client/languageParticipants.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { DocumentSelector } from 'vscode-languageclient';
76
import { Event, EventEmitter, extensions } from 'vscode';
7+
import { DocumentFilter, DocumentSelector } from 'vscode-languageclient';
88

99
/**
1010
* XML language participant contribution.
@@ -30,7 +30,7 @@ export function getLanguageParticipants(): LanguageParticipants {
3030
function update() {
3131
const oldLanguages = languages;
3232

33-
languages = new Set();
33+
languages = new Set<string>();
3434
languages.add('xml');
3535
languages.add('xsl');
3636
languages.add('dtd');
@@ -59,7 +59,18 @@ export function getLanguageParticipants(): LanguageParticipants {
5959

6060
return {
6161
onDidChange: onDidChangeEmmiter.event,
62-
get documentSelector() { return Array.from(languages); },
62+
get documentSelector() {
63+
return Array.from(languages) //
64+
.flatMap(language => {
65+
return [{
66+
language,
67+
scheme: 'file',
68+
}, {
69+
language,
70+
scheme: 'untitled',
71+
}] as DocumentFilter[];
72+
});
73+
},
6374
hasLanguage(languageId: string) { return languages.has(languageId); },
6475
dispose: () => changeListener.dispose()
6576
};

tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"outDir": "out",
66
"alwaysStrict": true,
77
"lib": [
8-
"es6",
9-
"dom"
8+
"dom",
9+
"es2019"
1010
],
1111
"sourceMap": true,
1212
"rootDir": ".",
@@ -20,4 +20,4 @@
2020
"node_modules",
2121
".vscode-test"
2222
]
23-
}
23+
}

0 commit comments

Comments
 (0)