Skip to content

Commit

Permalink
Fix for issue with environment path and Jedi (#22713)
Browse files Browse the repository at this point in the history
Fixes #22659
Fixes #22672

Jedi checks if the environment path is a path to a file or directory. If
it is a path, it uses it as is. If not it looks for a binary assuming it
is a virtual environment. Conda environments are structured differently
and it fails to find the binary, if we pass in the path to environment
directory.

The fix here is to always pass the path to the binary.
  • Loading branch information
karthiknadig authored Jan 4, 2024
1 parent e27119b commit 84ef0ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/activation/jedi/analysisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class JediLanguageServerAnalysisOptions extends LanguageServerAnalysisOpt
},
workspace: {
extraPaths: distinctExtraPaths,
environmentPath: this.interpreter?.envPath,
environmentPath: this.interpreter?.path,
symbols: {
// 0 means remove limit on number of workspace symbols returned
maxSymbols: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/test/activation/jedi/jediAnalysisOptions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ suite('Jedi LSP - analysis Options', () => {

const result = await analysisOptions.getAnalysisOptions();

expect(result.initializationOptions.workspace.environmentPath).to.deep.equal('.../.venv');
expect(result.initializationOptions.workspace.environmentPath).to.deep.equal('.../.venv/bin/python');
});

test('Without extraPaths provided and no workspace', async () => {
Expand Down

0 comments on commit 84ef0ee

Please sign in to comment.