vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Disable automatic highlighting of current token/word?

Open leeoniya opened this issue 10 years ago • 25 comments

Sorry if this has been asked before (I couldn't find it in any issues containing "highlight").

Is it possible to disable automatic highlighting of the current token/word without also disabling match-highlight for explicit selections via "editor.selectionHighlight": false?

Thanks!

  • VSCode Version: 1.0.0-insider
  • OS Version: Win10

auto-highlight

leeoniya avatar Apr 15 '16 15:04 leeoniya

I think editor.selectionHighlight does not stop semantic highlighting, so I don't think we have any option to disable semantic highlighting (from https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts#L120)

alexdima avatar Apr 28 '16 07:04 alexdima

I think editor.selectionHighlight does not stop semantic highlighting

Right, it shouldn't. But an additional option to disable this would be very welcome.

leeoniya avatar Apr 28 '16 14:04 leeoniya

@alexandrudima any updates?

Seems like an easy feature to add, let me know if there's any interest or if you'd like a pull request for this.

leeoniya avatar Jun 02 '16 17:06 leeoniya

:+1: on a PR. You can add a new editor option and use it in https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/wordHighlighter/common/wordHighlighter.ts#L120 -- that is where we do the call to do semantic word highlighting to language servers.

alexdima avatar Jun 06 '16 09:06 alexdima

+1 - I like selected matches to be highlighted, but I would like to be able to disable automatic keyword highlighting.

Bill-Stewart avatar Sep 08 '16 20:09 Bill-Stewart

This is really annoying visually.

Also in most themes there's barely a visual difference between a highlighted word and a selected one.

PierBover avatar Oct 26 '16 18:10 PierBover

I agree @PierBover. Please react  on the top post to raise its profile.

Bill-Stewart avatar Oct 26 '16 18:10 Bill-Stewart

@aeschli plz put this on your radar in case you'll be working on WordHighlighter for #12973

leeoniya avatar Oct 27 '16 15:10 leeoniya

any solution to this ?

jitendravyas avatar Nov 02 '16 09:11 jitendravyas

+1

realuser avatar Feb 26 '17 10:02 realuser

Added editor.occurrencesHighlight that can be set to false to turn this off. Will be available in tomorrow's insiders build and in the March stable release (i.e. not the one going out in the next few days)

alexdima avatar Mar 01 '17 17:03 alexdima

Thank you @alexandrudima !

Bill-Stewart avatar Mar 01 '17 17:03 Bill-Stewart

Having read this discussion a few times I assumed that setting editor.selectionHighlight to true and editor.occurrencesHighlight to false would result in the behavior I need: no automatic selection of a word where the cursor is, and a working selection once I select the whole word. But no, in fact, I don't see how editor.occurrencesHighlight changes anything at all, and editor.selectionHighlight turns highlighting off/on completely.

Still highlighting words automatically when the cursor is:

screen shot 2017-04-06 at 11 51 59

  • VSCode Version: 1.11.0
  • OS Version: MacOS 10.12.4

leikind avatar Apr 06 '17 09:04 leikind

Same for me. I also gather from the discussion above, the same conclusion that leikind came to, but I've just installed the latest update (1.11.1) and setting "editor.occurrencesHighlight": false seems to have no effect at all.

Language: Go VSCode: 1.11.1 OS: Windows 10

nevcook avatar Apr 07 '17 05:04 nevcook

I also am experiencing that setting "editor.occurrencesHighlight": false in user settings appears to have no effect on word highlighting in VSCode: 1.11.1.

If the cursor is on a word, all occurrences of that word are still highlighted.

realuser avatar Apr 07 '17 22:04 realuser

@alexandrudima Since "editor.occurrencesHighlight": false does not have any effect for at least 3 users, shouldn't this ticket be re-opened?

leikind avatar Apr 08 '17 18:04 leikind

Support for occurrencesHighlight seems to be language and extension dependent. On a freshly installed VSCode 1.11.1 with no extensions, changing editor.occurrencesHighlight: false only had effect for .js files, it didn't change anything for .rb, .sql or .py (i didn't try more file types).

After installing the recommended "Ruby" extension, highlighting occurrences is always disabled for Ruby files, changing the occurrencesHighlight flag doesn't have any effect.

Installing the recommended "Python" and "mssql" extensions didn't change anything for those file types, occurrences are always highlighted.

sullerandras avatar Apr 09 '17 01:04 sullerandras

@sullerandras I installed the Ruby extension and found out that no matter how I set editor.occurrencesHighlight, words in a Ruby file are never highlighted when the cursor is on a word. Contrary to, say, a plain text file when words are always highlighted no matter how I set editor.occurrencesHighlight.

leikind avatar Apr 09 '17 08:04 leikind

Thank you for the feedback. For cases where no extension registers a document highlight provider, the selection highlighter compensates and highlights whole words. This can happen for any language where we don't ship with such a document highlight provider (e.g. ruby, sql, python).

I've extracted this to #24426

alexdima avatar Apr 10 '17 10:04 alexdima

Updated my vscode to V1.11.2, and still "editor.occurrencesHighlight": false,

is not working to stop highlight semantic symbol occurrence. :(

dheerajwebkul avatar Apr 19 '17 10:04 dheerajwebkul