Skip to content

Commit

Permalink
fix(typescript): add workspace symbols support for TS plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jul 22, 2024
1 parent d0c3954 commit 669ce2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/language-server/lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export function createServerBase(
const status = {
connection,
fs: createFsWithCache(fs),
initializeParams: undefined as unknown as vscode.InitializeParams,
initializeResult: undefined as unknown as VolarInitializeResult,
languageServicePlugins: [] as unknown as LanguageServicePlugin[],
project: undefined as unknown as LanguageServerProject,
initializeParams: undefined! as vscode.InitializeParams,
initializeResult: undefined! as VolarInitializeResult,
languageServicePlugins: [] as LanguageServicePlugin[],
project: undefined! as LanguageServerProject,
pullModelDiagnostics: false,
documents,
workspaceFolders: createUriMap<boolean>(),
Expand Down
10 changes: 10 additions & 0 deletions packages/typescript/lib/node/proxyLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function createProxyLanguageService(languageService: ts.LanguageService)
case 'getCompletionEntryDetails': return getCompletionEntryDetails(language, target[p]);
case 'provideInlayHints': return provideInlayHints(language, target[p]);
case 'getFileReferences': return getFileReferences(language, target[p]);
case 'getNavigateToItems': return getNavigateToItems(language, target[p]);
}
};
},
Expand Down Expand Up @@ -971,6 +972,15 @@ function getFileReferences(language: Language<string>, getFileReferences: ts.Lan
return dedupeDocumentSpans(resolved);
};
}
function getNavigateToItems(language: Language<string>, getNavigateToItems: ts.LanguageService['getNavigateToItems']): ts.LanguageService['getNavigateToItems'] {
return (...args) => {
const unresolved = getNavigateToItems(...args);
const resolved = unresolved
.map(s => transformDocumentSpan(language, s, isReferencesEnabled))
.filter(s => !!s);
return dedupeDocumentSpans(resolved);
};
}

function linkedCodeFeatureWorker<T>(
language: Language<string>,
Expand Down

0 comments on commit 669ce2e

Please sign in to comment.