From a5ba46c4355ab91efa178c771837ed04aaf9f048 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Wed, 26 Jul 2023 11:24:34 +0800 Subject: [PATCH] chore: plural naming --- src/vs/editor/contrib/codelens/browser/codelens.ts | 4 ++-- .../documentSymbols/browser/outlineModel.ts | 14 +++++++------- .../contrib/gotoSymbol/browser/goToSymbol.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/vs/editor/contrib/codelens/browser/codelens.ts b/src/vs/editor/contrib/codelens/browser/codelens.ts index 682531509b658..4786a34be5983 100644 --- a/src/vs/editor/contrib/codelens/browser/codelens.ts +++ b/src/vs/editor/contrib/codelens/browser/codelens.ts @@ -44,11 +44,11 @@ export class CodeLensModel { export async function getCodeLensModel(registry: LanguageFeatureRegistry, model: ITextModel, token: CancellationToken): Promise { - const provider = registry.ordered(model); + const providers = registry.ordered(model); const providerRanks = new Map(); const result = new CodeLensModel(); - const promises = provider.map(async (provider, i) => { + const promises = providers.map(async (provider, i) => { providerRanks.set(provider, i); diff --git a/src/vs/editor/contrib/documentSymbols/browser/outlineModel.ts b/src/vs/editor/contrib/documentSymbols/browser/outlineModel.ts index e9746fec571d7..24f9f25a2de4b 100644 --- a/src/vs/editor/contrib/documentSymbols/browser/outlineModel.ts +++ b/src/vs/editor/contrib/documentSymbols/browser/outlineModel.ts @@ -196,8 +196,8 @@ export class OutlineModel extends TreeElement { const cts = new CancellationTokenSource(token); const result = new OutlineModel(textModel.uri); - const provider = registry.ordered(textModel); - const promises = provider.map((provider, index) => { + const providers = registry.ordered(textModel); + const promises = providers.map((provider, index) => { const id = TreeElement.findId(`provider_${index}`, result); const group = new OutlineGroup(id, result, provider.displayName ?? 'Unknown Outline Provider', index); @@ -221,8 +221,8 @@ export class OutlineModel extends TreeElement { }); const listener = registry.onDidChange(() => { - const newProvider = registry.ordered(textModel); - if (!equals(newProvider, provider)) { + const newProviders = registry.ordered(textModel); + if (!equals(newProviders, providers)) { cts.cancel(); } }); @@ -433,14 +433,14 @@ export class OutlineModelService implements IOutlineModelService { async getOrCreate(textModel: ITextModel, token: CancellationToken): Promise { const registry = this._languageFeaturesService.documentSymbolProvider; - const provider = registry.ordered(textModel); + const providers = registry.ordered(textModel); let data = this._cache.get(textModel.id); - if (!data || data.versionId !== textModel.getVersionId() || !equals(data.provider, provider)) { + if (!data || data.versionId !== textModel.getVersionId() || !equals(data.provider, providers)) { const source = new CancellationTokenSource(); data = { versionId: textModel.getVersionId(), - provider, + provider: providers, promiseCnt: 0, source, promise: OutlineModel.create(registry, textModel, source.token), diff --git a/src/vs/editor/contrib/gotoSymbol/browser/goToSymbol.ts b/src/vs/editor/contrib/gotoSymbol/browser/goToSymbol.ts index 02cc3acebabec..316c9cc47f2e3 100644 --- a/src/vs/editor/contrib/gotoSymbol/browser/goToSymbol.ts +++ b/src/vs/editor/contrib/gotoSymbol/browser/goToSymbol.ts @@ -20,10 +20,10 @@ async function getLocationLinks( registry: LanguageFeatureRegistry, provide: (provider: T, model: ITextModel, position: Position) => ProviderResult ): Promise { - const provider = registry.ordered(model); + const providers = registry.ordered(model); // get results - const promises = provider.map((provider): Promise => { + const promises = providers.map((provider): Promise => { return Promise.resolve(provide(provider, model, position)).then(undefined, err => { onUnexpectedExternalError(err); return undefined;