mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 03:39:23 +00:00
Use regular expression to identify config file names instead of singe file name
This commit is contained in:
@@ -90,7 +90,7 @@ export default class LanguageProvider extends Disposable {
|
||||
}
|
||||
|
||||
const base = basename(resource.fsPath);
|
||||
return !!base && base === this.description.configFile;
|
||||
return !!base && (!!this.description.configFilePattern && this.description.configFilePattern.test(base));
|
||||
}
|
||||
|
||||
private get id(): string {
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface LanguageDescription {
|
||||
readonly diagnosticSource: string;
|
||||
readonly diagnosticLanguage: DiagnosticLanguage;
|
||||
readonly modeIds: string[];
|
||||
readonly configFile?: string;
|
||||
readonly configFilePattern?: RegExp;
|
||||
readonly isExternal?: boolean;
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ export const standardLanguageDescriptions: LanguageDescription[] = [
|
||||
diagnosticSource: 'ts',
|
||||
diagnosticLanguage: DiagnosticLanguage.TypeScript,
|
||||
modeIds: [languageModeIds.typescript, languageModeIds.typescriptreact],
|
||||
configFile: 'tsconfig.json'
|
||||
configFilePattern: /tsconfig(\..*)?\.json/gi
|
||||
}, {
|
||||
id: 'javascript',
|
||||
diagnosticOwner: 'typescript',
|
||||
diagnosticSource: 'ts',
|
||||
diagnosticLanguage: DiagnosticLanguage.JavaScript,
|
||||
modeIds: [languageModeIds.javascript, languageModeIds.javascriptreact],
|
||||
configFile: 'jsconfig.json'
|
||||
configFilePattern: /jsconfig(\..*)?\.json/gi
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user