Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/windows-global
Browse files Browse the repository at this point in the history
* origin/main:
  Update diagnostics gutter icons and change default to "sign" (#2086)
  Fix short color box rendering bug after color presentation change (#2087)
  • Loading branch information
rchl committed Oct 14, 2022
2 parents 662494b + fbbfa5a commit 2ac298a
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 438 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.style.yapf export-ignore
codecov.yml export-ignore
docs/ export-ignore
icons/convert.bat export-ignore
icons/*.svg export-ignore
mypy.ini export-ignore
stubs/ export-ignore
tests/ export-ignore
Expand Down
2 changes: 1 addition & 1 deletion LSP.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

// Gutter marker for code diagnostics.
// Valid values are "dot", "circle", "bookmark", "sign" or ""
"diagnostics_gutter_marker": "dot",
"diagnostics_gutter_marker": "sign",

// Highlight style of links to internal or external resources, like another text document
// or a web site. Link navigation is implemented via the popup on mouse hover.
Expand Down
35 changes: 0 additions & 35 deletions icons/COPYRIGHT_NOTICE.md

This file was deleted.

416 changes: 21 additions & 395 deletions icons/LICENSE

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions icons/convert.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 16 -h 16 --export-filename=error.png error.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 32 -h 32 --export-filename=error@2x.png error.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 48 -h 48 --export-filename=error@3x.png error.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 16 -h 16 --export-filename=info.png info.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 32 -h 32 --export-filename=info@2x.png info.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 48 -h 48 --export-filename=info@3x.png info.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 16 -h 16 --export-filename=lightbulb.png lightbulb.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 32 -h 32 --export-filename=lightbulb@2x.png lightbulb.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 48 -h 48 --export-filename=lightbulb@3x.png lightbulb.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 16 -h 16 --export-filename=warning.png warning.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 32 -h 32 --export-filename=warning@2x.png warning.svg
inkscape --export-type=png --export-area=-1.23:-1.23:18.46:18.46 -w 48 -h 48 --export-filename=warning@3x.png warning.svg
Binary file modified icons/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/lightbulb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/lightbulb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions plugin/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
("error", "errors", "region.redish markup.error.lsp", "Packages/LSP/icons/error.png", _baseflags | sublime.DRAW_SQUIGGLY_UNDERLINE, sublime.DRAW_NO_FILL), # noqa: E501
("warning", "warnings", "region.yellowish markup.warning.lsp", "Packages/LSP/icons/warning.png", _baseflags | sublime.DRAW_SQUIGGLY_UNDERLINE, sublime.DRAW_NO_FILL), # noqa: E501
("info", "info", "region.bluish markup.info.lsp", "Packages/LSP/icons/info.png", _baseflags | sublime.DRAW_STIPPLED_UNDERLINE, sublime.DRAW_NO_FILL), # noqa: E501
("hint", "hints", "region.bluish markup.info.hint.lsp", "Packages/LSP/icons/info.png", _baseflags | sublime.DRAW_STIPPLED_UNDERLINE, sublime.DRAW_NO_FILL), # noqa: E501
("hint", "hints", "region.bluish markup.info.hint.lsp", "", _baseflags | sublime.DRAW_STIPPLED_UNDERLINE, sublime.DRAW_NO_FILL), # noqa: E501
] # type: List[Tuple[str, str, str, str, int, int]]

# sublime.Kind tuples for sublime.CompletionItem, sublime.QuickPanelItem, sublime.ListInputItem
Expand Down Expand Up @@ -813,14 +813,14 @@ def color_to_hex(color: Color) -> str:
return "#{:02x}{:02x}{:02x}".format(red, green, blue)


def lsp_color_to_html(view: sublime.View, color_info: ColorInformation) -> str:
def lsp_color_to_html(color_info: ColorInformation) -> str:
command = sublime.command_url('lsp_color_presentation', {'color_information': color_info})
return COLOR_BOX_HTML.format(command=command, color=color_to_hex(color_info['color']))


def lsp_color_to_phantom(view: sublime.View, color_info: ColorInformation) -> sublime.Phantom:
region = range_to_region(color_info['range'], view)
return sublime.Phantom(region, lsp_color_to_html(view, color_info), sublime.LAYOUT_INLINE)
return sublime.Phantom(region, lsp_color_to_html(color_info), sublime.LAYOUT_INLINE)


def document_color_params(view: sublime.View) -> Dict[str, Any]:
Expand Down
6 changes: 4 additions & 2 deletions plugin/session_buffer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .core.protocol import ColorInformation
from .core.protocol import Diagnostic
from .core.protocol import DiagnosticSeverity
from .core.protocol import DocumentLink
from .core.protocol import DocumentUri
from .core.protocol import InlayHint
Expand Down Expand Up @@ -66,7 +67,7 @@ def __init__(self, severity: int) -> None:
self.annotations = [] # type: List[str]
_, _, self.scope, self.icon, _, _ = DIAGNOSTIC_SEVERITY[severity - 1]
if userprefs().diagnostics_gutter_marker != "sign":
self.icon = userprefs().diagnostics_gutter_marker
self.icon = "" if severity == DiagnosticSeverity.Hint else userprefs().diagnostics_gutter_marker


class SemanticTokensData:
Expand Down Expand Up @@ -349,7 +350,8 @@ def _on_color_boxes_async(self, view: sublime.View, response: List[ColorInformat
if response is None: # Guard against spec violation from certain language servers
self.color_phantoms.update([])
return
self.color_phantoms.update([lsp_color_to_phantom(view, color_info) for color_info in response])
phantoms = [lsp_color_to_phantom(view, color_info) for color_info in response]
sublime.set_timeout(lambda: self.color_phantoms.update(phantoms))

# --- textDocument/documentLink ------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion sublime-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@
"sign",
""
],
"default": "dot",
"default": "sign",
"markdownDescription": "Gutter marker for code diagnostics."
},
"link_highlight_style": {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def test_lsp_color_to_phantom(self) -> None:
}
]
phantom = lsp_color_to_phantom(self.view, response[0])
self.assertEqual(phantom.content, lsp_color_to_html(self.view, response[0]))
self.assertEqual(phantom.content, lsp_color_to_html(response[0]))
self.assertEqual(phantom.region, range_to_region(response[0]["range"], self.view))

def test_document_color_params(self) -> None:
Expand Down

0 comments on commit 2ac298a

Please sign in to comment.