A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Microsoft/vscode-languageserver-node/issues/179 below:

nodePath not working (vscode-tslint) · Issue #179 · microsoft/vscode-languageserver-node · GitHub

You can read the original issues description in vscode-tslint #173.

Whenever I try to set a nodePath for vscode-tslint, it always ends up using the global node_modules path.

You can see that even though the NODE_PATH has a value, it still continues on to call resolveGlobalNodePath.

[Trace - 10:24:16 AM] NODE_PATH value is: c:\Projects\CloudTestGrading\node_modules\@remark\typescript\node_modules
[Trace - 10:24:17 AM] 'npm config get prefix' value is: C:\Program Files\nodejs
[Trace - 10:24:17 AM] NODE_PATH value is: C:\Program Files\nodejs\node_modules

From server/src/files.ts:

export function resolveModulePath(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void): Thenable<string> {
	if (nodePath) {
		if (!path.isAbsolute(nodePath)) {
			nodePath = path.join(workspaceRoot, nodePath);
		}
		return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
                        // This line seems to be the culprit
			if (value.indexOf(path.normalize(nodePath)) === 0) {
				return value;
			} else {
				return Promise.reject<string>(new Error(`Failed to load ${moduleName} from node path location.`));
			}
		}).then(undefined, (_error: any) => {
                        // We are passing a custom nodePath that _should_ be valid,
                        // so we do not expect this to be called.
			return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
		});
	} else {
		return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
	}
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4