Skip to content

Commit

Permalink
Add setting for scope used for error diagnostics
Browse files Browse the repository at this point in the history
Using sublimelinter's scopes is convenient but not everyone will have it installed
The setting is called diagnostic_error_region_scope
  • Loading branch information
tomv564 committed Aug 18, 2017
1 parent 481de7a commit f1be851
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion LSP.sublime-settings
Expand Up @@ -40,5 +40,6 @@
"show_status_messages": true,
"show_view_status": true,
"auto_show_diagnostics_panel": true,
"show_diagnostics_phantoms": true
"show_diagnostics_phantoms": true,
"diagnostic_error_region_scope": "sublimelinter.mark.error"
}
9 changes: 6 additions & 3 deletions main.py
Expand Up @@ -19,10 +19,12 @@

PLUGIN_NAME = 'LSP'
SUBLIME_WORD_MASK = 515
SUBLIME_LINTER_MARK_ERROR = 'sublimelinter.mark.error'
show_status_messages = True
show_view_status = True
auto_show_diagnostics_panel = True
show_diagnostics_phantoms = True
diagnostic_error_region_scope = SUBLIME_LINTER_MARK_ERROR # 'markup.deleted.diff'

configs = [] # type: List[ClientConfig]

Expand Down Expand Up @@ -240,6 +242,7 @@ def load_settings():
global show_view_status
global auto_show_diagnostics_panel
global show_diagnostics_phantoms
global diagnostic_error_region_scope
global configs
settings_obj = sublime.load_settings("LSP.sublime-settings")

Expand All @@ -255,7 +258,7 @@ def load_settings():
show_view_status = settings_obj.get("show_view_status", True)
auto_show_diagnostics_panel = settings_obj.get("auto_show_diagnostics_panel", True)
show_diagnostics_phantoms = settings_obj.get("show_diagnostics_phantoms", True)

diagnostic_error_region_scope = settings_obj.get("diagnostic_error_region_scope", SUBLIME_LINTER_MARK_ERROR)
settings_obj.add_on_change("_on_new_settings", load_settings)


Expand Down Expand Up @@ -1132,10 +1135,10 @@ def update_diagnostics_in_view(view: sublime.View, diagnostics: 'List[Diagnostic
phantom_set = phantom_sets_by_buffer[buffer_id]

phantom_set.update(phantoms)

# TODO: split between warning and error
if (len(regions)) > 0:
# TODO: stop stealing SublimeLinter's coloring.
view.add_regions("errors", regions, "sublimelinter.mark.error",
view.add_regions("errors", regions, diagnostic_error_region_scope,
"dot",
sublime.DRAW_SQUIGGLY_UNDERLINE | UNDERLINE_FLAGS)
else:
Expand Down

0 comments on commit f1be851

Please sign in to comment.