Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to configure VSCode properly? #12

Open
NicolasGoeddel opened this issue May 25, 2020 · 6 comments
Open

Question: How to configure VSCode properly? #12

NicolasGoeddel opened this issue May 25, 2020 · 6 comments

Comments

@NicolasGoeddel
Copy link

Hi,

I need more information about configuring VSCode after installed this recipe. This is the relevant part of my develop.cfg:

[omelette]
recipe = collective.recipe.omelette
eggs = ${buildout:eggs}

[vscode]
recipe = collective.recipe.vscode
eggs = ${buildout:eggs}
pylint-enabled = True
autocomplete-use-omelette = True
generate-envfile = True

Within VSCode I connect to my Linux server using the Remote Explorer and cd into ~/plone/zeocluster/parts/omelette/ where I find all the eggs and also my own addons. I then change the Python interpreter to ~/plone/zeocluster/bin/zopepy and enable linting using pylint. It seems to work somehow but it is very slow. Pressing F12 on an import lasts up to a minute until it opens a new tab with the module I am looking for. Any idea to speed this up? Can I do something better here or did I something wrong?

@fredvd
Copy link
Member

fredvd commented Jun 15, 2020

@NicolasGoeddel I'm also still searching for an 'optimal' configuration, or at least a config where the autocomplete/intellisense functions properly.

I still have quite a few python2.7 projects to support and I noticed that especially there, the indexing/analysing of python source files can 'hang' for a long time. If you search for this online you can find a lot of older reports (1-2 years) about this, and sometimes people say the slow downs went away with using jedi, and others prefer the vs code intellisense (python language server). And I'm not sure myself if pylint is causing the trouble or the intellisense features.

From what I understand, intellisense, linting and formatting are three different processes.

I didn't spot 'autocomplete-use-omelette' until I saw this Issue. In the code comments it seems to add the omelette paths to the jedi configuration specifically?

My biggest challenge with this recipe so far has been that it tries to parse the already existing settings.json generated by VS Code and does that in json strict mode. If you have one comma too much or don't use "true" for boolean values the recipe will fail.

@djay
Copy link
Member

djay commented Jul 4, 2020

@NicolasGoeddel I think the answer might be in this PR - #13
Using pylance is much faster but it needs a different way to set the extrapaths.
What I haven't done is seen if a brand new install of vscode gives you full capabilities when you just do the following

  • new vscode install
  • install pylance
  • use the vscode recipe with all default values

Can you test it? Just install this buildout and see if you can find any imported code.

@NicolasGoeddel
Copy link
Author

I just tested it and it works great.

My steps are:

  1. Modify you develop.cfg
parts =
    ...
    vscode

[vscode]
recipe = collective.recipe.vscode
  1. Run ./bin/buildout -c develop.cfg
  2. Install Pylance using VSCode and make it the default
  3. Change the Python interpreter to ~/Plone/zeocluster/bin/zopepy instead of the normal python binary for the entire workspace.

That's it.

@djay
Copy link
Member

djay commented Jul 17, 2020

@NicolasGoeddel great. hopefully there is a solution to step 4 in #14 .
Note you can also add the recipe to ~/.buildout/default.cfg so your local buildout doesn't need to change. how is in the readme.

@NicolasGoeddel
Copy link
Author

I didn't know about ~/.buildout/default.cfg but I also don't want to use it because I sometimes have more than one Plone installation in my home directory. That's the reason why I make all the changes in develop.cfg instead of buildout.cfg. I only touch buildout.cfg when I want to change the number of clients, ports, if it is should use a demo-storage or a RelStorage and such things. All the things related to the development were configured in develop.cfg.

@djay
Copy link
Member

djay commented Jul 30, 2020

@NicolasGoeddel you don't want automatic vscode support for all your buildouts without effort?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants