mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Don't register a new TypeScriptWorkspaceSymbolProvider for each mode, only for each language
This commit is contained in:
@@ -24,7 +24,8 @@ function getSymbolKind(item: Proto.NavtoItem): SymbolKind {
|
||||
export default class TypeScriptWorkspaceSymbolProvider implements WorkspaceSymbolProvider {
|
||||
public constructor(
|
||||
private client: ITypeScriptServiceClient,
|
||||
private modeId: string) { }
|
||||
private modeIds: string[]
|
||||
) { }
|
||||
|
||||
public async provideWorkspaceSymbols(search: string, token: CancellationToken): Promise<SymbolInformation[]> {
|
||||
// typescript wants to have a resource even when asking
|
||||
@@ -34,14 +35,14 @@ export default class TypeScriptWorkspaceSymbolProvider implements WorkspaceSymbo
|
||||
const editor = window.activeTextEditor;
|
||||
if (editor) {
|
||||
const document = editor.document;
|
||||
if (document && document.languageId === this.modeId) {
|
||||
if (document && this.modeIds.indexOf(document.languageId) >= 0) {
|
||||
uri = document.uri;
|
||||
}
|
||||
}
|
||||
if (!uri) {
|
||||
const documents = workspace.textDocuments;
|
||||
for (const document of documents) {
|
||||
if (document.languageId === this.modeId) {
|
||||
if (this.modeIds.indexOf(document.languageId) >= 0) {
|
||||
uri = document.uri;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -334,10 +334,10 @@ class LanguageProvider {
|
||||
this.toUpdateOnConfigurationChanged.push(implementationCodeLensProvider);
|
||||
this.disposables.push(languages.registerCodeLensProvider(selector, implementationCodeLensProvider));
|
||||
|
||||
for (const modeId of this.description.modeIds) {
|
||||
this.disposables.push(languages.registerWorkspaceSymbolProvider(new (await import('./features/workspaceSymbolProvider')).default(client, modeId)));
|
||||
this.disposables.push(languages.registerWorkspaceSymbolProvider(new (await import('./features/workspaceSymbolProvider')).default(client, this.description.modeIds)));
|
||||
|
||||
if (!this.description.isExternal) {
|
||||
if (!this.description.isExternal) {
|
||||
for (const modeId of this.description.modeIds) {
|
||||
this.disposables.push(languages.setLanguageConfiguration(modeId, {
|
||||
indentationRules: {
|
||||
// ^(.*\*/)?\s*\}.*$
|
||||
|
||||
Reference in New Issue
Block a user