-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't highlight literals #172
Comments
Thanks for submitting a bug report. What behavior do you consider a bug? Highlighting a string when you click in it is intended behavior — part of a language feature called "semantic highlighting". When you click on a string literal (or any identifier), the editor will highlight it and any other instances of it within the file. In the case of identifiers, it will also distinguish between writes and reads of that symbol, providing subtly different color hints for each. |
In MPLS, we disabled any sort of highlighting inside literals (sans fstring sections) as they were a bit distracting, so this is probably a behavior difference from that. |
We could consider doing there here too, but it would be inconsistent with other language servers. |
I don't think that's entirely true. I tested Go and TypeScript, and neither do this. (Nor do they enable hovers.) |
TypeScript's semantic highlight feature does highlight string literals. It doesn't include the quotes in the selection, but I decided when implementing the Python version that it made sense to include the quotes and the string type that precedes the quote. |
when i disabled pylance: |
Go differs in that literals are not types, so that's probably part of the reason they don't do it. But I was wrong about TypeScript. I had to pick a small string to get TypeScript do to it (my multi-line example did not have this behavior). But, I still don't think highlighting literals like this is very useful. I'd rather we only did it to actual bound names. @byehack For reference, that is VS Code's default behavior where it doesn't know anything but the words in the file. If you were to say write: test = 1234
"this is a test" And then selected The difference here is that we are highlighting the string literal as its own thing. |
Agreed. Just to give another example, clangd also doesn't highlight literals. |
I agree that it is distracting. I prefer that it can optionally be turned off. |
This issue has been fixed in version 2020.9.6, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202096-23-september-2020 |
Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf
Date: 2020-07-15T18:22:06.216Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362
The text was updated successfully, but these errors were encountered: