Repository: sublimelsp/LSP

Issue:
Option to disable validation underline and hover
Similar to https://github.com/sublimelsp/LSP/issues/762 but not looking to disable completely, just the underline (and hover) in the document.  Since the gutter mark can be disabled, why not the underline?

As far as I can tell, the capabilities provided by linters can go well beyond what the language servers provide in terms of identifying (and fixing) code style type issues.  If not disabling entirely, disabling underline (and hover) would eliminate the "collision"/duplication issues.  Would be especially useful if configurable by language.

FWIW, VSCode provides options to disable validations for languages.  Examples for Javascript and CSS:

![image](https://user-images.githubusercontent.com/1944277/72464066-9e66fa80-37a2-11ea-858b-1413860a74a5.png)

![image](https://user-images.githubusercontent.com/1944277/72463537-73c87200-37a1-11ea-8f6c-cad21f93fccf.png)




Discussion:
By "disable hover", do you mean that you want to still see hover information, but not diagnostics/errors/warnings in the resulting hover pop-up?
I'd like to be able to disable all validation visual indications (and validation hover) within the documents.  Right now, within documents, I have a lot of visual overlap of linter errors and LSP errors given there is partial overlap of what they check for.  For example see the box and squiggly underline in the following...

![image](https://user-images.githubusercontent.com/1944277/72537471-310ea480-384a-11ea-9337-b0df3af2c7d8.png)

The suggestion in https://github.com/sublimelsp/LSP/issues/762 not to use two syntax checkers doesn't work for me because there is only partial overlap of functionality.  We use standard and project-specific linter configurations for multiple languages (eslint, sytlelint, etc.) and I don't believe any language servers exist that support any/most of them.  Maybe I'm wrong.  

The language servers only cover part of the validation that the linters cover. Just as an example, none of the following issues are picked up by the language server (in this specific example javascript-typescript-langserver) because they are not necessarily syntax errors...

![image](https://user-images.githubusercontent.com/1944277/72538241-87301780-384b-11ea-9dd5-a9a1fa0d8b51.png)


I added a setting to allow disabling of showing diagnostics (gutter marks, highlights and hover info) in the document view.  Does what I was ultimately looking for.   Happy to create a PR if useful.
It feels like allowing "" in the `diagnostics_highlight_style` setting would be a reasonable way to disable the underlines. Is that what you did?
I agree.  That's the first approach I took, but I quickly realized that changing the the highlight style flags to support the empty option didn't eliminate the thick underline highlights like this:

![image](https://user-images.githubusercontent.com/1944277/72911281-c6f17600-3d07-11ea-86f6-291822445ff6.png)

I thought about making further updates to eliminate the thick underline for the empty highlight style but that seemed wrong and inconsistent with the behavior of other style options.

I also implemented a different approach that adds a "show_diagnostics_in_view" setting that enables/disables all diagnostics in the view.  This isn't very granular and I did't really want to add yet another setting, but it works.

After looking at https://github.com/sublimelsp/LSP/pull/800/files I realized that it was a simple change to make show_diagnostics_severity_level apply to the view as well (as it did previously).  I understand the logic for making that change, but, for me, the previous behavior accomplishes what I really (think) I wanted in the first place so I reverted that behavior for what I am using right now.

A reasonable solution might be to break up the "show_diagnostics_severity_level" setting into two: one for the view and one for everything else.  The downside of that would be yet another setting... and how to name the two.  On the plus side, it feels to me that the current behavior of "show_diagnostics_severity_level" not applying to the view may not be intuitive.  Having two separate settings would both give flexibility and make the behavior more obvious. 

BTW, much appreciation for a great an highly needed package.



Resolving patch:
diff --git a/plugin/session_view.py b/plugin/session_view.py
--- a/plugin/session_view.py
+++ b/plugin/session_view.py
@@ -1,5 +1,6 @@
 from .core.protocol import Diagnostic
 from .core.sessions import Session
+from .core.settings import settings as global_settings
 from .core.types import view2scope
 from .core.typing import Any, Iterable, List, Tuple
 from .core.views import DIAGNOSTIC_SEVERITY
@@ -112,7 +113,8 @@ def present_diagnostics_async(self, flags: int) -> None:
             data = data_per_severity.get(severity)
             if data is None:
                 self.view.erase_regions(key)
-            elif data.icon or flags != (sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE):
+            elif ((severity <= global_settings.show_diagnostics_severity_level) and
+                    (data.icon or flags != (sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE))):
                 self.view.add_regions(key, data.regions, data.scope, data.icon, flags)
             else:
                 self.view.erase_regions(key)


Test patch: