Skip to content

Commit

Permalink
chore(ext): use venv pylyzer if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Oct 16, 2024
1 parent 460ca54 commit 0157455
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "pylyzer",
"description": "A fast Python static code analyzer & language server for VSCode",
"publisher": "pylyzer",
"version": "0.1.9",
"version": "0.1.10",
"engines": {
"vscode": "^1.70.0"
},
Expand Down
6 changes: 6 additions & 0 deletions extension/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { type ExtensionContext, commands, window, workspace } from "vscode";
import { LanguageClient, type LanguageClientOptions, type ServerOptions } from "vscode-languageclient/node";
import fs from "node:fs";
import { showReferences } from "./commands";

let client: LanguageClient | undefined;

async function startLanguageClient(context: ExtensionContext) {
try {
const executablePath = (() => {
const fp = workspace.workspaceFolders?.at(0)?.uri.fsPath;
const venvExecutablePath = `${fp}/.venv/bin/pylyzer`;
if (fs.existsSync(venvExecutablePath)) {
return venvExecutablePath;
}
const executablePath = workspace.getConfiguration("pylyzer").get<string>("executablePath", "");
return executablePath === "" ? "pylyzer" : executablePath;
})();
Expand Down

0 comments on commit 0157455

Please sign in to comment.