Skip to content

Commit

Permalink
Only process XML documents with the schemes 'file' and 'untitled'
Browse files Browse the repository at this point in the history
Fixes #861

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Feb 15, 2023
1 parent efd52ad commit 7accd8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 14 additions & 3 deletions src/client/languageParticipants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { DocumentSelector } from 'vscode-languageclient';
import { Event, EventEmitter, extensions } from 'vscode';
import { DocumentFilter, DocumentSelector } from 'vscode-languageclient';

/**
* XML language participant contribution.
Expand All @@ -30,7 +30,7 @@ export function getLanguageParticipants(): LanguageParticipants {
function update() {
const oldLanguages = languages;

languages = new Set();
languages = new Set<string>();
languages.add('xml');
languages.add('xsl');
languages.add('dtd');
Expand Down Expand Up @@ -59,7 +59,18 @@ export function getLanguageParticipants(): LanguageParticipants {

return {
onDidChange: onDidChangeEmmiter.event,
get documentSelector() { return Array.from(languages); },
get documentSelector() {
return Array.from(languages) //
.flatMap(language => {
return [{
language,
scheme: 'file',
}, {
language,
scheme: 'untitled',
}] as DocumentFilter[];
});
},
hasLanguage(languageId: string) { return languages.has(languageId); },
dispose: () => changeListener.dispose()
};
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"outDir": "out",
"alwaysStrict": true,
"lib": [
"es6",
"dom"
"dom",
"es2019"
],
"sourceMap": true,
"rootDir": ".",
Expand All @@ -20,4 +20,4 @@
"node_modules",
".vscode-test"
]
}
}

0 comments on commit 7accd8a

Please sign in to comment.