Comments (3)
I briefly looked, and we get decls for all identifiers (basically names), but we only get the type of the decl, not at each specific position, which will cause us to do the narrowing and other things Eric mentioned above.
So, if we do it based on the declared type, there won't be any extra cost. However, if we want it to be precise and correct at each position where identifiers are used, there will be extra performance cost.
That said, since the semantic token provider and checker (the one that produces diagnostics) will share the same cache, and since the checker will call getType on every identifier anyway, in reality, the overall cost should be the same. It would be just a matter of who does it first and gets the blame.
For the same variable/parameter being colored differently if we decide to do it per each position, since we just mark the token with extra data and people who want it need to opt in, it might be okay?
But I am not here to draw conclusions but to provide more context so people can discuss with more information in hand.
from pylance-release.
If my understanding is correct, today's semantic token provider generates tokens based on semantic categories only, not on type information. What you're proposing would require the token provider to perform full type analysis of every identifier at every point in the code flow since the type of an identifier can change based on narrowing, assignments, etc. It also means that the color of an identifier might now vary from one place in the code flow to the next. And it would require you to decide what to do with types that involve unions between, for example, a callable type and a non-callable type.
from pylance-release.
how we will implement or how much perf cost it will have, we need to dig in but before that, we probably want to see how many people will upvote this.
from pylance-release.
Related Issues (20)
- Incorrect or unhelpful error: "ClassVar" is not allowed in this context HOT 10
- Function Docstrings Obscured By Decorators That Return Protocols HOT 5
- Save file lag HOT 2
- searchImport not finding modules HOT 4
- Pylance hangs after using "Go to Definition" on PySide6 objects HOT 2
- pylance JavaScript heap out of memory I set NODE_OPTIONS and exlude HOT 7
- IntelliSense/Pylance Semantic Highlighting and auto-code-completion is not working HOT 9
- Python intellisense not working HOT 2
- VS code "Find All References" does not find all references of a Python identifier HOT 2
- Not ignoring 'DELETE' keyword even it is enclosed with single or double quotes HOT 3
- Ability to force pylance to treat wrapped functions as functions as opposed to variables HOT 2
- Incorrect logic in unreachable code involving None and break HOT 2
- Show Type Hierarchy in notebook fails to find subtypes of type imported from .py file
- "requests" is not accessed Pylance. I am getting this problem when trying to import requests,it is already installed in the system but the word get coloured to green instead of white and when l click on it that is the info it shows HOT 2
- v2024.5.1: Resolving the import of non-"third party" modules HOT 8
- Remote extension host terminates unexpectedly HOT 15
- no module error if module was properly imported HOT 1
- Pylance doesn't stop analyzing files HOT 34
- Debug Failure. False expression: Check called before parsing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylance-release.