Skip to content

Commit

Permalink
Add back the python autocomplete paths and add the analysis paths on top
Browse files Browse the repository at this point in the history
  • Loading branch information
Daudi Wampamba committed Oct 3, 2022
1 parent 3c01797 commit baa873d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/ros/build-env-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ import * as pfs from "../promise-fs";
import * as telemetry from "../telemetry-helper";
import { rosApi } from "./ros";

const PYTHON_AUTOCOMPLETE_PATHS = "python.analysis.extraPaths";
const PYTHON_AUTOCOMPLETE_PATHS = "python.autoComplete.extraPaths";
const PYTHON_ANALYSIS_PATHS = "python.analysis.extraPaths";

/**
* Creates config files which don't exist.
*/
export async function createConfigFiles() {
const config = vscode.workspace.getConfiguration();

// Update the Python path if required.
// Update the Python autocomplete paths if required.
if (config.get(PYTHON_AUTOCOMPLETE_PATHS, []).length === 0) {
updatePythonPathInternal();
updatePythonAutoCompletePathInternal();
}

// Update the Python analysis paths if required.
if (config.get(PYTHON_ANALYSIS_PATHS, []).length === 0) {
updatePythonAnalysisPathInternal();
}

const dir = path.join(vscode.workspace.rootPath, ".vscode");
Expand Down Expand Up @@ -99,6 +105,13 @@ export function updatePythonPath(context: vscode.ExtensionContext) {
/**
* Updates the python autocomplete path to support ROS.
*/
function updatePythonPathInternal() {
function updatePythonAutoCompletePathInternal() {
vscode.workspace.getConfiguration().update(PYTHON_AUTOCOMPLETE_PATHS, extension.env.PYTHONPATH.split(path.delimiter));
}

/**
* Updates the python analysis path to support ROS.
*/
function updatePythonAnalysisPathInternal() {
vscode.workspace.getConfiguration().update(PYTHON_ANALYSIS_PATHS, extension.env.PYTHONPATH.split(path.delimiter));
}

0 comments on commit baa873d

Please sign in to comment.