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

ability to disable document_highlight_style on multiline string blocks #2246

Closed
titoBouzout opened this issue May 6, 2023 · 8 comments
Closed

Comments

@titoBouzout
Copy link
Contributor

Unless Im mistaken, it seems to me that document_highlight_style is causing multiline string to have a full border, which is very distracting.

image

I have searched and couldn't find a way to disable highlighting for multiline strings. Could be possible to add a preference to avoid this?

@predragnikolic
Copy link
Member

Hello,
Can you tell me what language server that is and how to reproduce it?

In the image I see the region being drawn as an outline.
I would guess that this the thing you are looking for is not for document_highlight_style as there is no "outline" style for document highlights.

I would guess that the region is caused by a diagnostic hint, so my best guess for now would be to suggest the following settings.

See what works for you:

1.Try to set show_multiline_diagnostics_highlights to false

// Show diagnostics spanning multiple lines in the view (as outlines).
  // See also: "diagnostics_highlight_style".
  "show_multiline_diagnostics_highlights": true,
  1. Try to ignore displaying hint diagnostics,
    set show_diagnostics_severity_level to 3
  // Show highlights and gutter markers in the file views for diagnostics
  // with level equal to or less than:
  // none: 0 (never show)
  // error: 1
  // warning: 2
  // info: 3
  // hint: 4
  "show_diagnostics_severity_level": 4,

@jwortmann
Copy link
Member

Those are really "DocumentHighlights", not diagnostics. It intentionally uses the outline if the range spans multiple lines, see 940c918.

I remember that the CSS server also used to use multi-line highlights for whole selector blocks, but AFAICT it doesn't do that anymore.

I would not be against adding the ability to configure the style for multi-line highlights, but personally I also don't need it, because I use the "background" option, which doesn't have the outline for multi-line highlight regions. So I will keep out of the decision whether to add a new setting for this. In fact, I would even suggest to make "background" the only possible style and remove the setting alltogether, if Sublime's default style for the region.<color>ish scopes' background were not so terrible as it is. (LSP provides more suitable overrides for all of the built-in color schemes.)

@titoBouzout
Copy link
Contributor Author

LSP TypeScript, a js file with the following code. Seems to me is highlighted when the string is a function parameter. Anyway, doesn't matter where the string is, if it is multiline, I would prefer to not have the full block highlighted. Is really not helpful and very distracting. About the background from previous comment, Im not sure what are you referring exactly, but I prefer very much underline highlighting.

something(
  `somethign something`,
  "something something",
  "something something",
  `
  it
  highlights
  the
  full
  block
  here
  `
);

@jwortmann
Copy link
Member

I was just referring to the "document_highlight_style": "background" option. You can try that if you use one of the default color schemes, like Mariana or Monokai.

For the underlines, it was like that before, and there is a screenshot in #1710 (comment) about how that looks. But feel free to prepare a PR or wait for more opinions, if this style should be added back as an option.

@titoBouzout
Copy link
Contributor Author

Thanks, I understand,

To be clear, I do not want any kind of highlight for multiline strings. It should be completely turned off.

I prefer this

image

Over this

image

Im trying to get rid of this

image

and also trying to get rid of this or any other kind of style for the whole multiline block.

image

@titoBouzout
Copy link
Contributor Author

There I sent a pull request adding a new preference #2247

@jwortmann
Copy link
Member

That's why I wrote that the default background for the region.<color>ish scopes is bad. I don't know what color scheme you use, but this is how it looks with built-in Monokai:

monokai

Some people may still not like the multiline highlights, so I guess yeah, a setting to disable them could be reasonable.

@rchl rchl closed this as completed May 8, 2023
@sricks
Copy link

sricks commented Jul 31, 2024

I've had LSP-typescript running on my project for weeks, but I never noticed this document highlighting until today; coincidentally when I installed several other plugins.

I drove myself crazy trying to fix it; I'm certain this functionality wasn't working for me before.

In any case, I strongly believe this should not be a default behavior in LSP. Discoverability was extremely poor; I had to disable every single Sublime plugin, one-by-one, to find out what was causing these outlines on multi-line strings.

And it's really quite ugly for most (all?) color schemes. If someone modifies their color scheme to work with this, they probably know enough to turn on the setting. It just really does not seem useful to me.

To aid anyone else searching: This is not related to BracketHighlighter, RainbowBrackets, or any sublime settings to match or highlight the contents of bracket contents. It is not related to match_brackets, match_tags, or match_selection.

The cause of this border or outline on sublime text multi-line strings in Javascript or Typescript using template literal string backticks is LSP documentHighlight, which can be discovered by running the command "LSP: Toggle Log Panel".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants