Use single diagnostic source for both js and ts

Fixes #48709

Use a unified diagnostic collection for js and ts since both diagnostics are provided by the typescript extension
This commit is contained in:
Matt Bierner
2018-05-03 15:53:33 -07:00
parent c488e28c29
commit b9459731b0
4 changed files with 13 additions and 9 deletions

View File

@@ -44,13 +44,13 @@ export class DiagnosticsManager {
private _enableSuggestions: boolean = true;
constructor(
language: string
owner: string
) {
for (const kind of allDiagnosticKinds) {
this._diagnostics.set(kind, new DiagnosticSet());
}
this._currentDiagnostics = vscode.languages.createDiagnosticCollection(language);
this._currentDiagnostics = vscode.languages.createDiagnosticCollection(owner);
}
public dispose() {

View File

@@ -53,7 +53,7 @@ export default class LanguageProvider {
}
}, this._validate);
this.diagnosticsManager = new DiagnosticsManager(description.id);
this.diagnosticsManager = new DiagnosticsManager(description.diagnosticOwner);
workspace.onDidChangeConfiguration(this.configurationChanged, this, this.disposables);
this.configurationChanged();

View File

@@ -108,6 +108,7 @@ export default class TypeScriptServiceClientHost {
id: 'typescript-plugins',
modeIds: Array.from(languages.values()),
diagnosticSource: 'ts-plugins',
diagnosticOwner: 'typescript',
isExternal: true
};
const manager = new LanguageProvider(this.client, description, this.commandManager, this.typingsStatus);

View File

@@ -5,22 +5,25 @@
import * as languageModeIds from './languageModeIds';
export interface LanguageDescription {
id: string;
diagnosticSource: string;
modeIds: string[];
configFile?: string;
isExternal?: boolean;
readonly id: string;
readonly diagnosticSource: string;
readonly modeIds: string[];
readonly configFile?: string;
readonly isExternal?: boolean;
readonly diagnosticOwner: string;
}
export const standardLanguageDescriptions: LanguageDescription[] = [
{
id: 'typescript',
diagnosticSource: 'ts',
diagnosticOwner: 'typescript',
modeIds: [languageModeIds.typescript, languageModeIds.typescriptreact],
configFile: 'tsconfig.json'
}, {
id: 'javascript',
diagnosticSource: 'js',
diagnosticSource: 'ts',
diagnosticOwner: 'typescript',
modeIds: [languageModeIds.javascript, languageModeIds.javascriptreact],
configFile: 'jsconfig.json'
}