Skip to content

How to use this? #388

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

Closed
gvanrossum opened this issue Jul 3, 2018 · 8 comments
Closed

How to use this? #388

gvanrossum opened this issue Jul 3, 2018 · 8 comments

Comments

@gvanrossum
Copy link

Excuse me if I'm dumb, but I'm new to both vscode and pyls, and I don't know anything about node.js either. How does one typically configure vscode to use pyls? By default it comes with a different Python package. I looked at README.rst and found instructions for developing pyls against vscode (which is my ultimate plan :-) but those instructions seem broken too:

$ yarn install .
yarn install v1.7.0
error `install` has been replaced with `add` to add new dependencies. Run "yarn add ." instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
$ yarn add .
yarn add v1.7.0
(node:23850) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1/5] 🔍  Validating package.json...
warning [email protected]: The engine "vscode" appears to be invalid.
[2/5] 🔍  Resolving packages...
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

What am I missing? (My ultimate goal is to write a plugin that adds access to mypy's internals to allow definition lookup and other functionality for Python -- the mypy-daemon has already collected the data, it's just a matter of getting it out. See https://mypy.readthedocs.io/en/latest/mypy_daemon.html for the current state of this project.)

@gvanrossum
Copy link
Author

Follow-up: I got the yarn thing to work with yarn add file:. but I'm still no closer to running pyls against the default vscode binary (i.e. not following the development recipe).

@mnazbro
Copy link
Contributor

mnazbro commented Jul 3, 2018

Hi, I believe the instructions were slightly misleading. The command yarn install (not yarn install .) will resolve dependencies and download them for you. You'll want to run that instead of yarn install .. yarn add . instead will add a new dependency called ..

@mnazbro mnazbro mentioned this issue Jul 3, 2018
@gvanrossum
Copy link
Author

OK, thanks -- yarn install without . works. So before you close this as "fixed", I still have that other question: given a non-dev version of VS Code (and with pyls installed) how does one use pyls from VS Code? My default VS Code instance still uses the default Python extension.

@gatesn
Copy link
Contributor

gatesn commented Jul 4, 2018

From within VSCode you can install the shell commands that enable you to run it from the command line: https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line

After this, the yarn run vscode command will open VSCode in extension development mode. Within this mode, pyls will run when you open a Python file. There will also be an output panel with the pyls logs. Pressing Ctrl/Cmd+R will refresh the window and restart pyls.

At the bottom of vscode-client/src/extension.ts you will find where pyls is configured to run. You can change this file to add -vvv flags, or to use an absolute path to pyls.

Some more general docs are available here: https://code.visualstudio.com/docs/extensions/developing-extensions

@gvanrossum
Copy link
Author

OK, so that's for extension developers. What do regular VS Code users do? Is there a place they can select pyls from the extensions marketplace? I don't see it here: https://marketplace.visualstudio.com/search?term=python&target=VSCode&category=All%20categories&sortBy=Relevance

@gatesn
Copy link
Contributor

gatesn commented Jul 4, 2018

Oh I see. No, we have an open ticket to publish a VSCode extension to the market place: #194

It's not quite clear to me what the proper way to do this is. I presume we don't package a Python runtime. Can probably follow Microsoft's example: https://github.com/Microsoft/vscode-python

@DrPyser
Copy link

DrPyser commented Nov 19, 2018

@gatesn Sorry if it's not appropriate to comment on a closed issue, but I'm still confused as to how to use pyls with vscode(though that may be vscode's fault). Do I have to install a plugin specifically developed for pyls which does not currently exist? My understanding of LSP was that the goal was to avoid this?

Is there not a way to tell vscode to use pyls as the python language server?

@dalisoft
Copy link

dalisoft commented Jun 1, 2020

Would be nice to use as Extension on VS(Code/Codium)

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

5 participants