dmarc3 / vscode-nastran

Nastran Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=mbakke.vscode-nastran&ssr=false
MIT License
7 stars 2 forks source link

Lift Python Extension and pygls requirements #86

Closed tony-hmi closed 1 week ago

tony-hmi commented 1 week ago

This PR adds a configuration option for the python interpreter and logic in the extension.ts script to use that configured python or hunt from a few likely paths for a python, prompt the user if they'd like to use it, then use it to create a virtual environment.

Been dabbling in language servers myself lately using this approach and thought this would reduce some user burden on this tool too.

dmarc3 commented 1 week ago

Hey @tony-hmi, First off, thanks for the PR and for contributing! Couple of comments.

  1. Can you change this PR to merge to the dev branch? The development flow is to merge to dev and then when I do a merge to main it will automatically publish / deploy to vscode marketplace via CI/CD. This results in a cleaner main branch and allows me to more concretely control the CHANGELOG.md and README.md.
  2. I need to review this more closely to make sure I understand what you're proposing. When I initially created this and went down the language-server route with pygls, I looked into automating the python dependencies stuff (albeit not as in depth as it seems you have). I ended up backing off after finding a number of threads like this.

I'll take a look at this more closely and shoot back some more comments.

tony-hmi commented 1 week ago

Okay, changing base was not a good idea, I'll fork dev, make the updates there and make a new PR.

As far as the user experience, this is just an improvement.

Current workflow. User installs extension and in worse case gets just syntax highlighting. They install the python extension, and then worse case they get errors about bad pygls import.

This workflow. The user installs the extension, and there are prompts that guide to indicate a python executable. If one is located, it's suggested to the user. Then do there's no dependency issue, it actually uses the indicated Python to create a virtual environment then installs any dependency in the requirements.txt.

The fact a user picks a python version and has to install pygls is unchanged. It's just smoother.