Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(vscode): ignore incompatible versions of the binary and improve the restart logic #4022

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Dec 9, 2022

Summary

The main goal of this PR is to introduce a version check on the binary distribution that's loaded from the workspace. Versions of the @rometools/cli-* packages lower than 0.9.0 did not include the language server, and as such will fail to initialize when spawned by the extension. I've added a simple check against the major and minor version of the package that to ignore versions that do not meet the current requirements of the extension and fall back to the bundled version of the binary if it's available.

In addition to this, I also made a minor change to the handler of the "Restart LSP Server" command to skip trying to stop the server if its not already running and only try to start it instead. Finally, I've updated the logic of the fileExists function to also handle the FileNotFound code that may also be returned by VSCode's filesystem functions.

Test Plan

I've tested these changes with a local build of the extension on a workspace using version 0.8.0 of the npm package and verified the extension did not try to load the incompatible version of the binary.

I've also tested the new restart logic by repeatedly stopping the Rome server process with an editor open until the extension stopped respawning it automatically, and verified the "Restart LSP Server" correctly spawned the server process again.

@leops leops added E-VScode Editors: VSCode A-Editors Area: editors labels Dec 9, 2022
@leops leops requested a review from a team as a code owner December 9, 2022 13:51
@netlify
Copy link

netlify bot commented Dec 9, 2022

Deploy Preview for docs-rometools ready!

Name Link
🔨 Latest commit 3083f3d
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63933d6ba712fe0008169d78
😎 Deploy Preview https://deploy-preview-4022--docs-rometools.netlify.app/playground
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@leops leops merged commit 76b2fa7 into main Dec 9, 2022
@leops leops deleted the fix/vscode-extension branch December 9, 2022 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Editors Area: editors E-VScode Editors: VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants