microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
915 stars 133 forks source link

No completions on for selenium WebElement selector #785

Open Astrantia opened 5 years ago

Astrantia commented 5 years ago
from selenium import webdriver
webdriver.Chrome().find_elements_by_css_selector().

This will not show any completions in vscode as it should

image

jakebailey commented 5 years ago

Are you using v0.2? If not, please retest with the beta build by adding this to your VS Code settings and restarting:

"python.analysis.downloadChannel": "beta"
Astrantia commented 5 years ago

I am using "daily" 0.2.25.0

Astrantia commented 5 years ago

@jakebailey were you able to reproduce this?

jakebailey commented 5 years ago

Yes. This one is tough; these functions call find_element, which calls execute and grabs some value from the response, which comes from _unwrap_value, which is complicated.

Astrantia commented 5 years ago

That means there are issues with 'tough' functions like that not getting completions. This should be given a priority 😃

MikhailArkhipov commented 5 years ago

Not necessarily. Depends on the how popular is the library and frequency of use of particular function.

Besides, not all functions can be analyzed with the definitive result. In dynamic untyped languages there is often not enough information in the code to tell what particular method returns. Consider void* func(void*) in C++ or object func(object) in C#. In this case stubs and annotations are source of information or the actual function body eval. However, evaluation also does not always work, esp if code itself creates objects dynamically or even compiles code written as strings.

Astrantia commented 5 years ago

Are you saying that PyCharm has a hardcoded fix for this?

MikhailArkhipov commented 5 years ago

It is a possibility, special casing is not unusual. PyCharm also has a lot of custom stubs.

rgeraskin commented 4 years ago

Is there any workaround? VS code completions are not usable with selenium completely.

image image

Version: 1.41.1 (system setup) Commit: 26076a4de974ead31f97692a0d32f90d735645c0 Date: 2019-12-18T14:58:56.166Z Electron: 6.1.5 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Windows_NT x64 10.0.17763

Name: Python Id: ms-python.python Description: Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, refactoring, unit tests, snippets, and more. Version: 2019.11.50794 Publisher: Microsoft

Microsoft Python Language Server version 0.5.10.0