Skip to content

Support for workspace settings #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
karthiknadig opened this issue Jun 6, 2024 · 2 comments
Closed

Support for workspace settings #23

karthiknadig opened this issue Jun 6, 2024 · 2 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@karthiknadig
Copy link
Member

karthiknadig commented Jun 6, 2024

  • conda
  • other similar settings

Note

  • Resolving python environment configured in settings will be resolved by Python extension via resolve api call
@karthiknadig karthiknadig added the feature-request Request for new features or functionality label Jun 6, 2024
@karthiknadig karthiknadig added this to the June 2024 milestone Jun 6, 2024
@DonJayamanne
Copy link
Collaborator

DonJayamanne commented Jun 17, 2024

Here is everything (all configuration setings) we need to pass to the native locator

        const pythonPathSettings = (workspace.workspaceFolders || []).map((w) =>
            getPythonSettingAndUntildify(DEFAULT_INTERPRETER_PATH_SETTING_KEY, w.uri.fsPath),
        );
        pythonPathSettings.push(getPythonSettingAndUntildify(DEFAULT_INTERPRETER_PATH_SETTING_KEY));
        // We can have multiple workspaces, each with its own setting.
        const pythonSettings = Array.from(new Set(pythonPathSettings.filter((item) => !!item)).values()).map((p) =>
            // We only want the parent directories.
            path.dirname(p!),
        );
        trackPromiseAndNotifyOnCompletion(
            this.connection
                .sendRequest<{ duration: number }>(
                    'refresh',
                    // Send configuration information to the Python finder.
                    // We need a cleaner configuration object.
                    {
                        // This has a special meaning in locator, its lot a low priority
                        // as we treat this as workspace folders that can contain a large number of files.
                        search_paths: (workspace.workspaceFolders || []).map((w) => w.uri.fsPath),
                        // Also send the python paths that are configured in the settings.
                        python_path_settings: pythonSettings,
                        conda_executable: getPythonSettingAndUntildify(CONDAPATH_SETTING_KEY),
                        poetry_path: getPythonSettingAndUntildify('poetryPath'),
                        pipenv_path: getPythonSettingAndUntildify('pipenvPath'),
                        // We do not want to mix this with `search_paths`
                        // Need a better name for `search_paths`.
                        virtual_env_dirs: getCustomVirtualEnvDirs(),
                    },
                )
                .then(({ duration }) => traceInfo(`Native Python Finder completed in ${duration}ms`))
                .catch((ex) => traceError('Error in Native Python Finder', ex)),
        );

@DonJayamanne
Copy link
Collaborator

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants