diff --git a/packages/language-server/src/plugins/PluginHost.ts b/packages/language-server/src/plugins/PluginHost.ts index b239c21ee..b02009acf 100644 --- a/packages/language-server/src/plugins/PluginHost.ts +++ b/packages/language-server/src/plugins/PluginHost.ts @@ -279,12 +279,18 @@ export class PluginHost implements LSProvider, OnWatchFileChanges { ): Promise { const document = this.getDocument(textDocument.uri); + // VSCode requested document symbols twice for the outline view and the sticky scroll + // Manually delay here and don't use low priority as one of them will return no symbols + await new Promise((resolve) => setTimeout(resolve, 1000)); + if (cancellationToken.isCancellationRequested) { + return []; + } return flatten( await this.execute( 'getDocumentSymbols', [document, cancellationToken], ExecuteMode.Collect, - 'low' + 'high' ) ); }