vscode/build/lib/mangle/renameWorker.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
952 B
TypeScript
Raw Normal View History

2024-11-15 06:29:18 +00:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as ts from 'typescript';
import * as workerpool from 'workerpool';
import { StaticLanguageServiceHost } from './staticLanguageServiceHost';
let service: ts.LanguageService | undefined;
function findRenameLocations(
projectPath: string,
fileName: string,
position: number,
): readonly ts.RenameLocation[] {
if (!service) {
service = ts.createLanguageService(new StaticLanguageServiceHost(projectPath));
}
return service.findRenameLocations(fileName, position, false, false, {
providePrefixAndSuffixTextForRename: true,
}) ?? [];
}
workerpool.worker({
findRenameLocations
});