55 comments

[ 3.3 ms ] story [ 123 ms ] thread
This sounds awesome. Can anyone with more familiarity with how it works provide some idea of how much better this would work vs. Sublime Text plugins like djaneiro?
It would mean that only one Python tool has to be written for all editors, rather than a specific plugin for each editor.

If Sublime Text has a better existing one then I'd stick with that until this improves.

Has anyone here used Visual Studio for python? How does it compare to Pycharm?
Much faster and leaner than PyCharm. Its a lille involved to set up completions for third party libs which are not installed using pip compared to PyCharm.

Completions on par with PyCharm but there are a few better refactorings in PyCharm but nothing that would make me switch back to PyCharm.

What are "third party libs which are not installed using pip"? I install all my libs with pip.
Lots of commercial libraries aren't pip installable for example.
Can you give an example? I've never worked with anything that's not pip-installable. Even my web backends are packaged as versioned pip packages - that's why it seems weird.
All the various libraries used to interact with software from companies like Autodesk and ESRI are one example.
But it has nothing to do with the fact that they can't do proper packaging. Using their own, proprietarily-compiled interpreter is what keeps you using their products in a controlled fashion.
PyQt and PySide until very recently, for example.

Usually it's stuff that has large native dependencies.

I agree with that one. Haven't used PyQT since Uni and it was a hell to make sure you could use it.

Frankly at the time I just assumed I couldn't download the package simply because it generally takes to long to compile Qt.

Here's an example: https://github.com/qnzhou/PyMesh. In fact, building it is a dependency hell.
Well, I can see that this is a WIP library and I can also see how people actively working on an academic project don't really bother (or do not have enough experience with the package system quirks) to package it well for a variety of systems.
Even your own? I use PYTHONPATH so that I don't need to pip upgrade every time I make a change.
That's what `pip install --editable` is for.
But it is super easy to configure per-project virtualenvs, so you can manually install stuff and have it Just Work inside vscode.
Can I use their implementation with emacs-lsp or similar? I can't find a download link for their language server as a standalone install.
FTA: It is available first today in the July release of the Python Extension for Visual Studio Code, and we will later release it as a standalone component that you can use with any tool that works with the Language Server Protocol.
That's the idea behind the Language Server Protocol, and it seems they will later based on a sibling comment. I love that Microsoft helped to pioneer LSP (not Lumpy Space Princess) because there's too much of a duplicated effort done for other editors. I hope in the future they can team up with JetBrains and make the protocol even more awesome.
JetBeains wasn't very interested in this in the past, mostly because it duplicates effort they've already invested and their solution seems to be better. For now.
we have gradually started moving away from Pycharm to vscode at my workplace and have really been happy.

This feature is super important if they want to build support for running and debugging python applications remotely... or in docker (which is something we want as well).

I'm curious as to why you'd want to move away from Pycharm?
Not parent but for me two main reasons would be : free, lighter / faster.
yes - vscode is far far lighter. The autocompletion,etc is not as good as pycharm...but stuff like this language server will accelerate the progress there.

also pandas/numpy - vscode is not super great in debugging today, but the performance makes up for it.

For me both code and pycharm are way too heavy for my celeron work-provided pc. I am really happy with gvim and notepad++.
Though PyCharm is a Java application, in my experience it is very well behaved. Not the typical Java resource hog.

Contrast with VSCode, written in Electron. I will admit that VSCode is one of the better Electron apps in regards to keeping the UI snappy, but it still hogs literary GBs of RAM without even having any files open (CentOS desktop). It will consume a full CPU core just sitting there if it is not minimized, I'm told that this is to blink the cursor. VSCode is decent if it is the only app you have open, but it is just too resource intensive in real world computing.

actually your info is very very dated. this was an issue long ago. FYI - I'm based out of India and a lot of interns,etc here can only afford AMD laptops with 4 GB of RAM and HDD. we are not even close to macbook territory here.

We actually moved these kids to vscode first. And then we realized how good vscode's performance really was.

I'd guess mindshare, ecosystem. Creating add-ons for VS Code is a cake walk.

I've attempted plugins for both Eclipse and IntelliJ. Multiple times. Defeat. I'm just not smart or stubborn enough to make something shippable.

No one hates JavaScript more than me (day gig is all nodejs). And I'm surprised to hear myself say that VS Code's superior design far outweighs the liability of using JavaScript. Especially the Language Server Protocol, which is a game changer.

I'll probably let my IntelliJ Ultimate subscription expire this year. Too bad. I really like Jetbrains.

> I've attempted plugins for both Eclipse and IntelliJ. Multiple times. Defeat.

Can you help us understand what you were trying to make, and the ways in which you experienced "defeat"?

I've tried to create a plugin for my ANTLR4 grammar. Most recently, I started with [https://github.com/antlr/jetbrains-plugin-sample]. I just can't wrap my head around maintaining parallel trees, syncing their state, how everything's connected.

So then I looked at MPS again. Maybe reimplement my grammar with MPS et al. Worked thru the tutorials. Again, I just can't figure out which way is up.

I recently watched an interview with Anders Hejlsberg about Roslyn and Language Server Protocol, where they decoupled the IDE from the compiler. Eureka. Makes perfect sense. In practice, it's a (comparative) cake walk.

I wonder how it compares to Palantir’s Python Language Server[1] that uses Jedi[2] for intellisense.

[1] https://github.com/palantir/python-language-server

[2] https://github.com/davidhalter/jedi

My pet peeve with Jedi is, that it doesn't support autocompletion for type libraries, that are not parsable python code. For example, anything from gi.repository (i.e. entire Gtk) is then without autocomplete.

Jetbrains IDEs do support it: you have to manually generate the symbol cache for the first time, but the IDE knows your intent and maintains it for you, and for you as the user, autocomplete just works.

Another thing that Jetbrains has better, is weighing the importance of symbols that are offered: Open a random Django project, try to define a model and see, where the autocomplete makes better sense.

(comment deleted)
This was my question as well. Seems odd to start from scratch when this already exists. Unless the MS version is a fork of the Palantir one.
MS language server is not based on Jedi. It is based on Python Tools for Visual Studio. Core components were ported to .NET Core so it runs on all platforms. The core engine is not just for IntelliSense, it is capable of many more functions.
Where can we see what it's capable of? For now it seems very incapable to me. Much worse than intellij or jedi.
Please feel free to file issue on github if something is missing.

Visual Studio has full functionality but not all of it is exposed through the LS protocol just yet. Having full cross file code model helps with many things.

From what I've seen (MS folks can correct me here), language services are part of a much larger effort at Microsoft led by Anders Heijsberg (Delphi, C#) called Roslyn [1], which decouples code analysis from IDEs and provides things like refactoring, autocomplete, find-all-references, Intellisense, etc. as services.

This means the compiler is now an abstracted platform that editors can get services from (CompilerAndCodeAnalysis-as-a-service?). Anders talks about the motivation for doing that here [2].

It's a pretty exciting idea. This might mean I would some day be able to use Vim and get IDE-like functionality.

[1] Roslyn https://github.com/dotnet/roslyn/wiki/Roslyn-Overview [2] https://www.youtube.com/watch?v=wSdV1M7n4gQ

Python extension for VS Code provides both MS Language Server and Jedi based intellisense. Default is actually Jedi as LS is in preview.
I've tried it, seems to be much worse than intellij. Doesn't understand namedtuples. Doesn't infer types, doesn't check for unhandled exceptions. I'm disappointed. What's with this 'execution simulation'? They aren't better than simple ctags.
Does anybody know if this is implemented in Python (I assume in a process run from the editor)? Or has it perhaps been implemented in JS/TS?

The reason I ask is because the Monaco code editor from VSCode can be used in the browser, and having Python Language Server implemented in JS means that any online editor using Monaco could potentially offer the same functionality from the browser itself without having to keep a connection to a backend server doing the lifting.

From the article:

"For performance, it runs with .NET Core on Windows, macOS and Linux, works with Python 2.5 through to Python 3.7 and supports the latest language features"

This is awesome, tried installing Jedi with neovim on a raspberry pi and ridiculously slow. I wonder if this could fix it....
The language server currently only supports 64-bit Linux, so if you have that on your Pi then it should be faster.
Sourcegraph CTO here. This is great news and we're looking forward to incorporating this into Sourcegraph's existing Python support (https://about.sourcegraph.com/), so users get all the code intelligence improvements in their code reviews and code browsers. Thanks for open sourcing!