MCPcopy Index your code
hub / github.com/microsoft/vscode-languageserver-node / resolveModulePath

Function resolveModulePath

server/src/files.ts:267–285  ·  view source on GitHub ↗
(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void)

Source from the content-addressed store, hash-verified

265}
266
267export function resolveModulePath(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void): Thenable<string> {
268 if (nodePath) {
269 if (!path.isAbsolute(nodePath)) {
270 nodePath = path.join(workspaceRoot, nodePath);
271 }
272
273 return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
274 if (FileSystem.isParent(nodePath, value)) {
275 return value;
276 } else {
277 return Promise.reject<string>(new Error(`Failed to load ${moduleName} from node path location.`));
278 }
279 }).then<string, string>(undefined, (_error: any) => {
280 return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
281 });
282 } else {
283 return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
284 }
285}
286
287/**
288 * Resolves the given module relative to the given workspace root. In contrast to

Callers 1

resolveModule2Function · 0.85

Calls 2

resolveGlobalNodePathFunction · 0.85
resolveFunction · 0.70

Tested by

no test coverage detected