From 1c788c2b061fc0078fa031a61d275a49d820104d Mon Sep 17 00:00:00 2001 From: Denis Loginov <137337+dinvlad@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:33:01 -0400 Subject: [PATCH] Add vscode lsp version check (#44) * [vscode] Add wdl-lsp version check * Remove Travis config --- .travis.old.yml | 34 ---------------------------------- client/vscode/src/extension.ts | 11 ++++++++--- 2 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 .travis.old.yml diff --git a/.travis.old.yml b/.travis.old.yml deleted file mode 100644 index 2b98d2d..0000000 --- a/.travis.old.yml +++ /dev/null @@ -1,34 +0,0 @@ -jobs: - include: - - stage: Deploy Server - if: &release_tag tag =~ /^\d+\.\d+\.\d+$/ - dist: bionic - language: python - python: 3.7 - before_install: - - cd server - script: - - python3 setup.py sdist bdist_wheel - - twine upload --skip-existing dist/* - - - stage: Deploy Clients - name: VSCode - if: *release_tag - language: node_js - node_js: node - install: - - cd client/vscode - - npm ci - script: - - npm version ${TRAVIS_TAG} - - vsce publish -p ${VSCE_TOKEN} - - - stage: Deploy Clients - name: IntelliJ - if: *release_tag - language: java - jdk: openjdk8 - before_install: - - cd client/intellij - script: - - ./gradlew publishPlugin -Ptoken=${INTELLIJ_TOKEN} diff --git a/client/vscode/src/extension.ts b/client/vscode/src/extension.ts index 76329f7..2548f1b 100644 --- a/client/vscode/src/extension.ts +++ b/client/vscode/src/extension.ts @@ -90,9 +90,14 @@ export async function activate(context: ExtensionContext) { throw new Error(`${language}.pythonPath is not set`); } - await promisify(execFile)(pythonPath, [ - "-m", "pip", "install", "--user", "wdl-lsp==" + version, - ]); + const { stdout } = await promisify(execFile)(pythonPath, ["-m", "pip", "show", "wdl-lsp"]); + const versionStr = stdout.split('\n').find(line => line.startsWith('Version:')); + if (!versionStr || versionStr.split(':')[1].trim() !== version) { + await promisify(execFile)(pythonPath, [ + "-m", "pip", "install", "--user", "wdl-lsp==" + version, + ]); + } + client = startLangServer(pythonPath, ["-m", "wdl_lsp"], cwd); }