microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.33k stars 1.19k forks source link

LSP support to 3rd-parties #21964

Closed karthiknadig closed 9 months ago

trinhanhngoc commented 9 months ago

Hello @karthiknadig ,

I am a bit curious about this issue. Does it mean that the Python extension will allow using other contributed language servers besides Jedi and Pylance?

karthiknadig commented 9 months ago

@trinhanhngoc This was to provide support tools using the following products:

  1. This code generator for LSP types in various languages: https://github.com/microsoft/lsprotocol . This was to standardize and make it easier for Server implementers to ingest changes to LSP specification.
  2. LSP types packages for various languages. These are concrete packages that we publish that LSP implementers can depend on
  3. Template for VS extension for python based tools: https://github.com/microsoft/vscode-python-tools-extension-template . This template allows you to create an extension for VS Code, with tools running in python.

With the above three things, you could contribute a Language Server of your own. You can turn off the ones that are shipped with python extension ("python.languageServer" : "None"), and run one of your own. Note that this was never something that was blocked. The only thing the above 3 things did was to make it lot easier to create LSP based VS code extensions (see Ruff Extension a 3rd party Linting and formatting extension based on Ruff). The Jedi language server that we use is also based on the above packages (jedi-language-server)

If you want to create your own server and would like to use our template here is a video (live stream) where I show how to do it:

All of this was meant to be is a quick starting point to and move the interesting part of LSP development into Python or Rust.

trinhanhngoc commented 9 months ago

@karthiknadig , Many thanks for the detailed explanation.