MCPcopy
hub / github.com/DetachHead/basedpyright / addPythonPath

Function addPythonPath

packages/vscode-pyright/src/extension.ts:237–263  ·  view source on GitHub ↗
(settings: any[])

Source from the content-addressed store, hash-verified

235 // For backwards compatibility, set python.pythonPath to the configured
236 // value as though it were in the user's settings.json file.
237 const addPythonPath = (settings: any[]): Promise<any[]> => {
238 const pythonPathPromises: Promise<string | undefined>[] = params.items.map((item) => {
239 if (item.section === 'python') {
240 const uri = item.scopeUri ? Uri.parse(item.scopeUri) : undefined;
241 return getPythonPathFromPythonExtension(client.outputChannel, uri, () => {
242 // Posts a "workspace/didChangeConfiguration" message to the service
243 // so it re-queries the settings for all workspaces.
244 client.sendNotification(DidChangeConfigurationNotification.type, {
245 settings: null,
246 });
247 });
248 }
249 return Promise.resolve(undefined);
250 });
251
252 return Promise.all(pythonPathPromises).then((pythonPaths) => {
253 pythonPaths.forEach((pythonPath, i) => {
254 // If there is a pythonPath returned by the Python extension,
255 // always prefer this over the pythonPath that uses the old
256 // mechanism.
257 if (pythonPath !== undefined) {
258 settings[i].pythonPath = pythonPath;
259 }
260 });
261 return settings;
262 });
263 };
264
265 return addPythonPath(result);
266 },

Callers 1

activateFunction · 0.85

Calls 7

parseMethod · 0.80
sendNotificationMethod · 0.80
resolveMethod · 0.65
thenMethod · 0.65
mapMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…