Skip to content
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

Selection highlight settings #51869

Closed
SerCarciofini opened this issue Jun 14, 2018 · 4 comments
Closed

Selection highlight settings #51869

SerCarciofini opened this issue Jun 14, 2018 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-contrib Editor collection of extras verified Verification succeeded

Comments

@SerCarciofini
Copy link

Issue Type: Bug

Looks like setting selection highlight this way
"editor.selectionHighlight": false,
"editor.occurrencesHighlight": true
disables occurrencesHighlight anyway, no matter if it's true or false

VS Code version: Code 1.24.1 (24f6262, 2018-06-13T17:47:35.732Z)
OS version: Linux x64 4.15.0-23-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i3-4005U CPU @ 1.70GHz (4 x 1332)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: unavailable_software
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled
Load (avg) 0, 1, 1
Memory (System) 7.71GB (0.93GB free)
Process Argv /usr/share/code/code /tmp/fz3temp-2/archivio.php
Screen Reader no
VM 0%
Extensions (4)
Extension Author (truncated) Version
jshint dba 0.10.19
svn-scm joh 1.29.2
vscode-language-pack-it MS- 1.24.3
vscode-code-outline pat 0.2.1
@vscodebot
Copy link

vscodebot bot commented Jun 14, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@alexdima
Copy link
Member

@SerCarciofini This depends from language to language.

It is a bit complicated, but here goes:


  • extensions can contribute a DocumentHighlightProvider for their language. This should be a semantic highlighter which highlights, for example, the same variable. You can see this in action in a .js file (notice how nn is highlighted semantically, the first occurrence is not highlighted):
    image
  • this feature can be turned off via editor.occurrencesHighlight

  • there is another feature called selection highlighting. This kicks in when making a selection and is non semantic (it will highlight all occurences of the selection):
    image
  • this feature can be turned off via editor.selectionHighlight

Now, there is a long tail of languages which we also want to support. For a lot of them, we don't have rich extensions that can implemented semantic highlights. So, if a language does not register a DocumentHighlightProvider, we fall back to the selection highlighter even when there is no selection. You can see this kicking in for example in plain text:
image

  • you can think of this fallback as an implementation of a very simple DocumentHighlightProvider. Currently, this gets disabled when either editor.occurrencesHighlight or editor.selectionHighlight are set to false.

Would you expect that this last one should be disabled only when configuring editor.occurrencesHighlight to false?

@SerCarciofini
Copy link
Author

Would you expect that this last one should be disabled only when configuring editor.occurrencesHighlight to false?

Actually yes because with the current logic, there's no way to disable editor.occurrencesHighlight while keeping the fallback you described. Or it might make sense add an additional explicit setting for this fallback.

@alexdima alexdima added this to the On Deck milestone Jun 26, 2018
@alexdima
Copy link
Member

To verify, configure:

"editor.selectionHighlight": false,
"editor.occurrencesHighlight": true

Then open a plain text file and check that words are still highlighted, even if selectionHighlight is turned off.

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug editor-contrib Editor collection of extras and removed editor labels Sep 11, 2018
@alexdima alexdima modified the milestones: On Deck, September 2018 Sep 11, 2018
@jrieken jrieken added the verified Verification succeeded label Sep 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-contrib Editor collection of extras verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants