Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/lib/mangle/renameWorker.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import ts from 'typescript';
7
import workerpool from 'workerpool';
8
import { StaticLanguageServiceHost } from './staticLanguageServiceHost';
9
10
let service: ts.LanguageService | undefined;
11
12
function findRenameLocations(
13
projectPath: string,
14
fileName: string,
15
position: number,
16
): readonly ts.RenameLocation[] {
17
if (!service) {
18
service = ts.createLanguageService(new StaticLanguageServiceHost(projectPath));
19
}
20
21
return service.findRenameLocations(fileName, position, false, false, {
22
providePrefixAndSuffixTextForRename: true,
23
}) ?? [];
24
}
25
26
workerpool.worker({
27
findRenameLocations
28
});
29
30