Giter Club home page Giter Club logo

Comments (46)

ssbarnea avatar ssbarnea commented on August 15, 2024 44

I am not sure why so many people are so happy about PyLance as they missed to read between the lines: PyLance is not open-source. I kinda find very hard not to think about the Embrace, extend, and extinguish approach.

Today we add closed-sourced components, tomorrow mandatory free SaaS services and the day after tomorrow we start charging users for using them.

from python-language-server.

hanezu avatar hanezu commented on August 15, 2024 31

For those who wonder how to trigger auto-importing as I did, here are the steps.

  1. Enable Microsoft Python Language Server by removing the check of Python: Jedi Enabled in your settings.
  2. Reload the VSCode window.
  3. Hover your mouse over the variable that you want to import, and click Quick fix...

For the last step, if it shows No quick fixes available or Checking for quick fixes, you may need to wait for a while until the extension has finished code analysis. It is also possible to set a shortcut that triggers a quick fix.

from python-language-server.

MeTaNoV avatar MeTaNoV commented on August 15, 2024 26

Looking forward!

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 21

The current PR for this is #1656, and is being worked on.

from python-language-server.

EmadMokhtar avatar EmadMokhtar commented on August 15, 2024 19

Any updates? I'm missing this feature from PyCharm. As I can see #242 is closed and merged.

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 11

For those of you interested in what Pyright provides in VS Code, I would recommend looking at what we just posted today, a new LS based on Pyright that integrates fully with the Python extension.

https://devblogs.microsoft.com/python/announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code/

Thanks for your patience!

from python-language-server.

ericbiewener avatar ericbiewener commented on August 15, 2024 10

I've built an extension that does exactly what the OP described. Hopefully this helps! https://marketplace.visualstudio.com/items?itemName=edb.vandelay

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 10

You can already try this if you're on our daily build, but we're working on fixing other bugs before we can release everything to stable.

from python-language-server.

lig avatar lig commented on August 15, 2024 9

too bad the language server itself still cannot offer as good experience as jedi

from python-language-server.

najeeb-thalakkatt avatar najeeb-thalakkatt commented on August 15, 2024 8

When is the approximate release of this feature ?

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024 7

It is no longer blocked, but it is not in scope at the moment. There are other issues to attend to as we rewrote LS almost from scratch. I can't name specific time frame yet sorry.

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 7

It is not pushed to stable quite yet, but will be soon. You can test it ahead of time by putting this in your configuration:

"python.analysis.downloadChannel": "beta"

from python-language-server.

lauevrar77 avatar lauevrar77 commented on August 15, 2024 6

Is there any hints when this feature will be merged ?

from python-language-server.

oesah avatar oesah commented on August 15, 2024 6

This is really the only missing feature from VSCode Python. I love how it works with Typescript, if we can get this feature working properly, PyCharm will have a hard time staying alive I believe.

from python-language-server.

tiangolo avatar tiangolo commented on August 15, 2024 6

This wasn't obvious to me up until recently, but the official Python extension works great in combination with Pyright: https://github.com/microsoft/pyright

Pyright provides a bunch of other useful features, like suggesting automatic imports.

It also handles better some edge cases like types for pathlib.Path and others.

It's not a replacement for the Python extension but works very well on top.

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024 5

@lauevrar77 - if you install Zenhub extension to Chrome you will be able to see our scrum board and the prioritized backlog.

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024 5

You no longer need beta channel as new LS in in stable. However, there is no auto-import feature if that is you wanted to test. As mentioned above, the issue is no longer blocked but it is not schedule to be implemented just yet.

from python-language-server.

Jma353 avatar Jma353 commented on August 15, 2024 5

Is this something that will be worked on soon? This would be an awesome feature, and make this language server even more compelling than it already is!

from python-language-server.

AlexSwensen avatar AlexSwensen commented on August 15, 2024 5

For anyone else who has googled trying to set this up, I wrote a very quick blog post for how I fixed it.

from python-language-server.

elicore avatar elicore commented on August 15, 2024 5

This wasn't obvious to me up until recently, but the official Python extension works great in combination with Pyright: https://github.com/microsoft/pyright

Pyright provides a bunch of other useful features, like suggesting automatic imports.

It also handles better some edge cases like types for pathlib.Path and others.

It's not a replacement for the Python extension but works very well on top.

Thanks! I've been using VSCode for so long and haven't even heard of it. It works great!
It should definitely be a part of the Python extension. The functionality it provides is sorely missing when moving from more advanced IDEs like PyCharm.

from python-language-server.

jedie avatar jedie commented on August 15, 2024 4

This is one of the features that keeps me from using vscode.
Any plan when this will be available?

edb.vandelay doesn't suit me ;)
Are there any useful alternatives that can be easily installed and used right now?

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024 3

Python extension has no code analysis facilities to detect missing imports or perform import resolution. All this requires code analysis and this is why feature is here. So reopening extension issue won't help much.

You are probably not getting light bulb (code action) because code could not determine where Page might be coming from. So it is not that feature is not implemented, it most probably this particular case is not completely handled or there is not enough information available.

Missing imports feature indexes libraries trying to determine where particular symbol is coming from. Indexing is not analysis, it is basically just parsing. Analysis of the entire Python installed libraries would take forever. So there is always limit of what index might recover. For example, it would not recover symbols available in compiled C++ code.

Thus, @autoferrit and @julien-c, please open separate issues with your specific case.

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 3

This issue is closed, the code action (light bulb / diagnostic quick fix) for adding imports was implemented in October and has been released for a few months now. If you have an issue with the existing feature or comments on new features, please create a new issue as previously noted.

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024 2

No, it won't be using importmagic. We need to finish #425 first since it addresses performance, memory consumption as well as understanting or typing.

from python-language-server.

najeeb-thalakkatt avatar najeeb-thalakkatt commented on August 15, 2024 1

@jakebailey
Where should I add this ? And how can I test auto import ?

from python-language-server.

jakebailey avatar jakebailey commented on August 15, 2024 1

I mean of the language server. We haven't been versioning here on GitHub, but do so for VS Code consumption of builds released from master. This feature has been out for a few months, but we're currently at 0.5.10. You can find the version printed by the LS.

Yes, the LS provides static analysis. If you have a problem, please report it as a new issue.

from python-language-server.

autoferrit avatar autoferrit commented on August 15, 2024 1

I am on vscode insiders 1.42.0 and language server version is 0.5.10.0. I followed @AlexSwensen 's link above and disabled jedi. But I still don't get any way to auto import, or have it suggest imports. It is looking at my proper venv as well. I dont get a quick fix option, and right clicking on the missing import doesn't show an option to add the import. Am I missing something?
image

from python-language-server.

grisaitis avatar grisaitis commented on August 15, 2024 1

Exciting! Congrats to the team. Looking forward to trying this out.

Looking forward to poetry virtualenvs being auto detected (at some point) ;)

from python-language-server.

codethief avatar codethief commented on August 15, 2024 1

I'm very disappointed that Pylance is closed-source and that the Microsoft Python Language Server will be no longer be supported in the future but having now wasted hours on getting import quick fixes working, it looks I have no other choice than to resort to Pylance for the time being. Here are the settings that I put in my workspace's settings.json to enable it:

    "python.linting.enabled": true,
    "python.jediEnabled": false,
    "python.linting.pylintEnabled": false,
    "python.linting.mypyEnabled": false,
    "python.languageServer": "Pylance",

(Make sure pylint is disabled or otherwise import quick fixes might not work, probably because pylint conflicts with Pylance. As for the mypy setting, I didn't actually try mypy but simply wanted to prevent conflicts with Pyright which comes integrated in Pylance.)

from python-language-server.

MikhailArkhipov avatar MikhailArkhipov commented on August 15, 2024

#242 comes first

from python-language-server.

lauevrar77 avatar lauevrar77 commented on August 15, 2024

It seems legit, I must admit :). So no rough deadline at this time ?

from python-language-server.

agalazis avatar agalazis commented on August 15, 2024

hopefully it won't use importmagic xD
some of the frequent issues I face:
alecthomas/importmagic#47
pilat/vscode-importmagic#9 (comment)
but even if it does maybe we could do PRs on import magic itself xD

from python-language-server.

agalazis avatar agalazis commented on August 15, 2024

I think the second one could be done by skipping importmagic's sorting and triggering vscode one

from python-language-server.

dmitrii-stebliuk avatar dmitrii-stebliuk commented on August 15, 2024

Any updates? Why is it blocked?

from python-language-server.

jamesstidard avatar jamesstidard commented on August 15, 2024

Hi @MikhailArkhipov

Sorry a little off-topic but the rewrite you reference, do you know what version number that is and if it's rolled out in vscode? I notice a large memory footprint and want to see if the new version has helped. It could also be that the projects are large.

Thanks for the work.

from python-language-server.

IgorKrupenja avatar IgorKrupenja commented on August 15, 2024

@jedie Have you tried this one? https://marketplace.visualstudio.com/items?itemName=brainfit.vscode-importmagic

from python-language-server.

PhilParisot avatar PhilParisot commented on August 15, 2024

Any updates? When's the ETA?

from python-language-server.

ace-han avatar ace-han commented on August 15, 2024

@AlexSwensen what's shortcut/keyword for auto imports?
Only the word quick fix?

from python-language-server.

grisaitis avatar grisaitis commented on August 15, 2024

@jakebailey when you say stable, are you referring to the stable release for the language server or for vs code? if for this repo, how do i use the nightly build of this LS with vs code?

for some reason, i cannot get vs code to do simple code analysis such as detecting an undeclared variable, let alone an unresolved import.

is that what this language server is implementing? static code analysis for python in vs code?

from python-language-server.

julien-c avatar julien-c commented on August 15, 2024

Given that:

  • vscode-python does not use python-language-server (unless specifically directed, which I'm guessing few users do)
  • #1656, merged in October 2019 does not (correct me if I'm wrong) seem to be in a release used in vscode-python,

maybe the maintainers of vscode-python should reopen microsoft/vscode-python#21?

(cc @luabud and @DonJayamanne)

PS: thanks for the great work y'all!

from python-language-server.

sbassah avatar sbassah commented on August 15, 2024

Is there any update on when this feature will be released. It will really make using VS Code for Python development great.

from python-language-server.

peterdeme avatar peterdeme commented on August 15, 2024

Jedi is disabled by default, I don't think that's the problem for most people.
What I believe is the main source of the confusion is that you need to explicitly enable linting in order to get this working.
image

Even though it is written in the official docs page, it's not immediately obvious honestly.

from python-language-server.

julien-c avatar julien-c commented on August 15, 2024

Are you sure Jedi is disabled by default now? This was not the case even a couple of weeks ago.

from python-language-server.

elicore avatar elicore commented on August 15, 2024

This feature doesn't work. I'm using 1.47.0-insider and the only way I get missing imports intellisense is if I use the Importmagic extension.

from python-language-server.

autoferrit avatar autoferrit commented on August 15, 2024

@ssbarnea I totally agree. The reason I use pylance, is because I have fight all the time with the existing tools to get autocomplete to work reliably. sometimes, it only works with words in the file. other, it knows nothing, other times, imports seem to be nothing related to what I want. I have been through so many articles it was just exhausting.
I decided to keep pylance when I installed it, said to use it as the completion engine, and it just worked, and it worked really nice (granted still nowhere near what pycharm gives, but for being free, its great). I will keep trying the LS version now and then to see if I can get it working again, but until then, I just want things to work so I can write code. That being said, I do REALLY look forward to the LS being more robust.

from python-language-server.

aringot avatar aringot commented on August 15, 2024

@ssbarnea any alternative to recommend? (and thanks for the link!)

from python-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.