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

Add supports for Microsoft Pylance #18

Open
nazrulworld opened this issue Sep 28, 2020 · 1 comment
Open

Add supports for Microsoft Pylance #18

nazrulworld opened this issue Sep 28, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@nazrulworld
Copy link
Collaborator

https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

@nazrulworld nazrulworld added the enhancement New feature or request label Sep 28, 2020
@NicolasGoeddel
Copy link

I figured out that it PyLance works out of the box if you simply specify zopepy instead of python as your default interpreter.
When I work on Plone projects I have often checked out multiple packages in the src folder. Therefore I use one workspace file with one folder for my home directory and then for every source an other folder. in the end it looks like this:

{
	"folders": [
		{
			"path": "."
		},
		{
			"path": "Plone/zeocluster/src/my.addon1"
		},
		{
			"path": "Plone/zeocluster/src/my.addon2"
		}
	],
	"settings": {
		"files.associations": {
			"*.zcml": "xml"
		},
		"python.pythonPath": "~/Plone/zeocluster/bin/zopepy",
		"files.exclude": {
			"**/__pycache__": true
		},
		"files.watcherExclude": {
			"**/var/blobstorage/**": true,
			"**/var/filestorage/**": true,
		},
		"git.autofetch": true
	}
}

I save this file as workspace.code-workspace in the home directory and open it with VSCode. Just make sure that the path to zopepy is absolute because otherwise Pylance will throw errors.

You do not even need collective.recipe.vscode anymore. Autocompletion just works because zopepy already knows all the things you need.

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

No branches or pull requests

2 participants