profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/tomv564/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Tom van Ommeren tomv564 Uppsala, Sweden

sublimelsp/LSP 1130

Client implementation of the Language Server Protocol for Sublime Text

lukexi/stack-ide-sublime 28

An Sublime Text IDE for Haskell based on stack-ide

tomv564/autojump 0

A cd command that learns - easily navigate directories from the command line

tomv564/autojump-rs 0

A Rust port and drop-in replacement of autojump

tomv564/babel-handbook 0

:blue_book: A guided handbook on how to use Babel and how to create plugins for Babel.

tomv564/diff-match-patch-cpp-stl 0

C++ STL variant of https://code.google.com/p/google-diff-match-patch.

tomv564/edbee-lib 0

QWidget based Text Editor Component for Qt. Multi-caret, Textmate grammar and highlighting support.

pull request commentsublimelsp/LSP

Add setting to render code lenses as a phantom

I've force pushed the changesets to rebase from the previous refactoring and it's ready for review again.

Rapptz

comment created time in 16 minutes

Pull request review commentsublimelsp/lsp_utils

Add tests

+name: main++on:+  push:+    branches:+      - master+    paths-ignore:+      - ".github/workflows/docs.yml"+      - "docs/**"+  pull_request:+    branches:+      - master+    paths-ignore:+      - ".github/workflows/docs.yml"+      - "docs/**"++env:+  SUBLIME_TEXT_VERSION: "4"+  SUBLIME_TEXT_ARCH: x64+  PACKAGE: lsp_utils+  UNITTESTING_TAG: master++jobs:+  macOS:+    runs-on: macos-latest+    steps:+      - uses: actions/checkout@v1+      - run: echo "$HOME/.local/bin" >> $GITHUB_PATH+      - run: echo "$HOME/Library/Python/3.7/bin" >> $GITHUB_PATH+      - run: curl --silent https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/ci.sh --output ci.sh+      - run: |+          sh ci.sh bootstrap+          sh ci.sh install_package LSP main https://github.com/sublimelsp/LSP.git+          sh ci.sh install_package LSP-pyright master https://github.com/sublimelsp/LSP-pyright.git+          sh ci.sh install_package_control+          subl --stay &+          sleep 8+          sh ci.sh run_tests+        name: Run UnitTesting tests++  Linux:+    runs-on: ubuntu-latest+    container: sublimetext/unittesting+    steps:+      - uses: actions/checkout@v1+      - run: sudo apt update+      - run: sudo apt install --no-install-recommends -y x11-xserver-utils python3-pip+      - run: sh -e /etc/init.d/xvfb start+      - run: curl -OL https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/github.sh+      - run: echo "$HOME/.local/bin" >> $GITHUB_PATH+      - run: |+          PATH="$HOME/.local/bin:$PATH"+          sh github.sh bootstrap+          rm -rf "$HOME/.config/sublime-text/Packages/lsp_utils"+          sh github.sh install_package LSP main https://github.com/sublimelsp/LSP.git+          sh github.sh install_package LSP-pyright master https://github.com/sublimelsp/LSP-pyright.git+          sh github.sh install_package_control+          rm -rf "$HOME/.config/sublime-text/Packages/lsp_utils"+          mkdir -p "$HOME/.config/sublime-text/Packages/lsp_utils"+          cp -r ./ "$HOME/.config/sublime-text/Packages/lsp_utils"

Trying stuff out to workaround a blocking issue. See https://github.com/SublimeText/UnitTesting/issues/193

rchl

comment created time in 5 hours

Pull request review commentsublimelsp/lsp_utils

Add tests

+name: main++on:+  push:+    branches:+      - master+    paths-ignore:+      - ".github/workflows/docs.yml"+      - "docs/**"+  pull_request:+    branches:+      - master+    paths-ignore:+      - ".github/workflows/docs.yml"+      - "docs/**"++env:+  SUBLIME_TEXT_VERSION: "4"+  SUBLIME_TEXT_ARCH: x64+  PACKAGE: lsp_utils+  UNITTESTING_TAG: master++jobs:+  macOS:+    runs-on: macos-latest+    steps:+      - uses: actions/checkout@v1+      - run: echo "$HOME/.local/bin" >> $GITHUB_PATH+      - run: echo "$HOME/Library/Python/3.7/bin" >> $GITHUB_PATH+      - run: curl --silent https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/ci.sh --output ci.sh+      - run: |+          sh ci.sh bootstrap+          sh ci.sh install_package LSP main https://github.com/sublimelsp/LSP.git+          sh ci.sh install_package LSP-pyright master https://github.com/sublimelsp/LSP-pyright.git+          sh ci.sh install_package_control+          subl --stay &+          sleep 8+          sh ci.sh run_tests+        name: Run UnitTesting tests++  Linux:+    runs-on: ubuntu-latest+    container: sublimetext/unittesting+    steps:+      - uses: actions/checkout@v1+      - run: sudo apt update+      - run: sudo apt install --no-install-recommends -y x11-xserver-utils python3-pip+      - run: sh -e /etc/init.d/xvfb start+      - run: curl -OL https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/github.sh+      - run: echo "$HOME/.local/bin" >> $GITHUB_PATH+      - run: |+          PATH="$HOME/.local/bin:$PATH"+          sh github.sh bootstrap+          rm -rf "$HOME/.config/sublime-text/Packages/lsp_utils"+          sh github.sh install_package LSP main https://github.com/sublimelsp/LSP.git+          sh github.sh install_package LSP-pyright master https://github.com/sublimelsp/LSP-pyright.git+          sh github.sh install_package_control+          rm -rf "$HOME/.config/sublime-text/Packages/lsp_utils"+          mkdir -p "$HOME/.config/sublime-text/Packages/lsp_utils"+          cp -r ./ "$HOME/.config/sublime-text/Packages/lsp_utils"

What is achieved by removing the lsp_utils folder, than re-creating it again with the same files?

rchl

comment created time in 5 hours

push eventsublimelsp/lsp_utils

Rafal Chlodnicki

commit sha 759e9755d9ccd729108365fe7a20586ecb80d413

hackyhack

view details

push time in 5 hours

issue commentsublimelsp/LSP

show_diagnostics_highlights does not allow styling

I don't personally understand the difficulty of adding a customization option that uses the defaults added in #1710 but allows for customization in a setting as before. The code below is where I found the defaults are being set: https://github.com/sublimelsp/LSP/blob/12de1dae52fe9664fbaf885d3a687e6cf1dc2d01/plugin/core/views.py#L32-L38

eproxus

comment created time in 6 hours

push eventsublimelsp/lsp_utils

Rafal Chlodnicki

commit sha 63d30276916af28dd05a3d0ceacccea466178146

try

view details

push time in 8 hours

push eventsublimelsp/lsp_utils

Rafal Chlodnicki

commit sha 585b06168d2de14a91e0862d5c1f1f8b2f062407

create before unittesting does

view details

push time in 8 hours

push eventsublimelsp/lsp_utils

Rafal Chlodnicki

commit sha 4653444acb8c66d89f9b25789f75ccd249a5a23c

disable ignore_vcs_packages

view details

push time in 8 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def _start_progress_reporter_async(self, request_id: int, title: str) -> ViewPro         self.progress[request_id] = progress         return progress +    # --- textDocument/codeLens ----------------------------------------------------------------------------------------++    def start_code_lenses_async(self) -> None:+        params = {'textDocument': text_document_identifier(self.view)}+        for request_id, request in self.active_requests.items():+            if request.method == "codeAction/resolve":+                self.session.send_notification(Notification("$/cancelRequest", {"id": request_id}))+        self.session.send_request_async(+            Request("textDocument/codeLens", params, self.view),+            self._on_code_lenses_async+        )++    def _on_code_lenses_async(self, response: Optional[List[CodeLens]]) -> None:+        self._code_lenses.clear_annotations()+        if not isinstance(response, list):+            return+        self._code_lenses.handle_response(self.session.config.name, response)+        self.resolve_visible_code_lenses_async()++    def resolve_visible_code_lenses_async(self) -> None:+        if self._code_lenses.is_empty():+            self.start_code_lenses_async()+            return++        promises = []  # type: List[Promise[None]]+        for code_lens in self._code_lenses.unresolved_visible_code_lens(self.view.visible_region()):+            callback = functools.partial(code_lens.resolve, self.view)+            promise = self.session.send_request_task(+                Request("codeLens/resolve", code_lens.data, self.view)+            ).then(callback)+            promises.append(promise)+        Promise.all(promises).then(lambda _: self._code_lenses.render())++    def get_resolved_code_lenses_for_region(self, region: sublime.Region) -> Generator[CodeLens, None, None]:+        yield from self._code_lenses.get_resolved_code_lenses_for_region(region)

This code is equivalent to the old one so not a new issue but I don't really see the point of returning a generator when the caller is always gonna iterate through all the results anyway. I haven't measured it but it must be quite a bit slower then just returning a plain or even a tuple.

Rapptz

comment created time in 9 hours

push eventsublimelsp/lsp_utils

Rafal Chlodnicki

commit sha 73f1af1fdf19ce0ea5eff1fe27750ed405c1e383

install packages

view details

push time in 10 hours

push eventsublimelsp/LSP

Danny

commit sha 05d64625655cde07c3b1812dcd171022e2f3df78

Refactor code lenses (#1755) This changes the following: * Code lens state is stored in its own class * Code lenses are moved to SessionView instead of DocumentSyncListener * The code lens debounce time is lowered to 300ms from 2300ms

view details

push time in 10 hours

PR merged sublimelsp/LSP

Refactor code lenses

This changes the following:

  • Code lens state is stored in its own class
  • Code lenses are moved to SessionView instead of DocumentSyncListener
  • The code lens debounce time is lowered to 300ms from 2300ms

I'm aware this is a big change. The development was discussed in the Discord server in preparation of allowing to render code lenses as phantoms. As a result the PR for that one is blocked until this one is finalised since it depends on the refactoring done here.

I tried my best to separate the code that dealt with the phantom representation but some of the data changes might still linger and seem bizarre.

+246 -130

0 comment

6 changed files

Rapptz

pr closed time in 10 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

+from .core.protocol import CodeLens, Range+from .core.typing import List, Tuple, Dict, Iterable, Generator+from .core.registry import LspTextCommand+from .core.registry import windows+from .core.views import make_command_link+from .core.views import range_to_region+from html import escape as html_escape+import itertools+import sublime+++class CodeLensData:+    __slots__ = (+        'data',+        'region',+        'session_name',+        'annotation',+    )++    def __init__(self, data: CodeLens, view: sublime.View, session_name: str) -> None:+        self.data = data+        self.region = range_to_region(Range.from_lsp(data['range']), view)+        self.session_name = session_name+        self.annotation = '...'+        self.resolve_annotation()++    def __repr__(self) -> str:+        return 'CodeLensData(resolved={0}, region={1!r})'.format(self.is_resolved(), self.region)++    def is_resolved(self) -> bool:+        """A code lens is considered resolved if the inner data contains the 'command' key."""+        return 'command' in self.data++    def to_lsp(self) -> CodeLens:+        copy = self.data.copy()+        copy['session_name'] = self.session_name+        return copy++    @property+    def small_html(self) -> str:+        return '<small style="font-family: system">{}</small>'.format(self.annotation)++    def resolve_annotation(self) -> None:+        command = self.data.get('command')+        if command is not None:+            command_name = command.get('command')+            if command_name:+                self.annotation = make_command_link('lsp_execute', command['title'], {+                    'session_name': self.session_name,+                    'command_name': command_name,+                    'command_args': command.get('arguments', []),+                })+            else:+                self.annotation = html_escape(command['title'])+        else:+            self.annotation = '...'++    def resolve(self, view: sublime.View, code_lens: CodeLens) -> None:+        self.data = code_lens+        self.region = range_to_region(Range.from_lsp(code_lens['range']), view)+        self.resolve_annotation()+++class CodeLensView:+    CODE_LENS_KEY = 'lsp_code_lens'++    def __init__(self, view: sublime.View) -> None:+        self.view = view+        self._code_lenses = {}  # type: Dict[Tuple[int, int], List[CodeLensData]]++    def clear(self) -> None:+        self._code_lenses.clear()++    def is_empty(self) -> bool:+        return not self._code_lenses++    def clear_annotations(self) -> None:+        for index, _ in enumerate(self._flat_iteration()):+            self.view.erase_regions(self._region_key(index))++    def _region_key(self, index: int) -> str:+        return '{0}.{1}'.format(self.CODE_LENS_KEY, index)

We're still keying on only the index, not the session. Oh well, maybe for a next step.

Rapptz

comment created time in 11 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def _on_color_boxes(self, response: Any) -> None:     def on_code_lens_capability_registered_async(self) -> None:         self._do_code_lenses_async() -    def _code_lens_key(self, index: int) -> str:-        return self.CODE_LENS_KEY + str(index)--    def _render_code_lens(self, name: str, index: int, region: sublime.Region, command: Optional[Command]) -> None:-        if command is not None:-            command_name = command.get("command")-            if command_name:-                annotation = make_command_link("lsp_execute", command["title"], {-                    "session_name": name,-                    "command_name": command_name,-                    "command_args": command.get("arguments")-                })-            else:-                annotation = command["title"]-        else:-            annotation = "..."-        annotation = '<div class="codelens">{}</div>'.format(annotation)-        accent = self.view.style_for_scope("region.greenish markup.accent.codelens.lsp")["foreground"]-        self.view.add_regions(self._code_lens_key(index), [region], "", "", 0, [annotation], accent)-     def _do_code_lenses_async(self) -> None:         session = self.session_async("codeLensProvider")         if session and session.uses_plugin():-            params = {"textDocument": text_document_identifier(self.view)}             for sv in self.session_views_async():                 if sv.session == session:-                    for request_id, request in sv.active_requests.items():-                        if request.method == "codeAction/resolve":-                            session.send_notification(Notification("$/cancelRequest", {"id": request_id}))-            name = session.config.name-            session.send_request_async(-                Request("textDocument/codeLens", params, self.view),-                lambda r: self._on_code_lenses_async(name, r))--    def _on_code_lenses_async(self, name: str, response: Optional[List[CodeLens]]) -> None:-        for i in range(0, len(self._code_lenses)):-            self.view.erase_regions(self._code_lens_key(i))-        self._code_lenses.clear()-        if not isinstance(response, list):-            return-        for index, c in enumerate(response):-            region = range_to_region(Range.from_lsp(c["range"]), self.view)-            self._code_lenses.append((c, region))-            if "command" in c:-                # We consider a code lens that has a command to be already resolved.-                self._on_resolved_code_lens_async(name, index, region, c)-            else:-                self._render_code_lens(name, index, region, None)-        self._code_lenses = list((c, range_to_region(Range.from_lsp(c["range"]), self.view)) for c in response)-        self._resolve_visible_code_lenses_async()+                    sv.start_code_lenses_async()      def _resolve_visible_code_lenses_async(self) -> None:         session = self.session_async("codeLensProvider")-        if session:-            for index, code_lens, region in self._unresolved_code_lenses(self.view.visible_region()):-                callback = functools.partial(self._on_resolved_code_lens_async, session.config.name, index, region)-                session.send_request_async(Request("codeLens/resolve", code_lens, self.view), callback)--    def _on_resolved_code_lens_async(self, name: str, index: int, region: sublime.Region, code_lens: CodeLens) -> None:-        code_lens["session_name"] = name-        try:-            self._code_lenses[index] = (code_lens, region)-        except IndexError:-            return-        self._render_code_lens(name, index, region, code_lens["command"])--    def _unresolved_code_lenses(-        self,-        visible: sublime.Region-    ) -> Generator[Tuple[int, CodeLens, sublime.Region], None, None]:-        for index, tup in enumerate(self._code_lenses):-            code_lens, region = tup-            if not code_lens.get("command") and visible.intersects(region):-                yield index, code_lens, region+        if session and session.uses_plugin():+            for sv in self.session_views_async():+                if sv.session == session:+                    sv.resolve_visible_code_lenses_async()

resolve for all sessions attached to the view because the data is stored per session now?

Rapptz

comment created time in 11 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def _on_color_boxes(self, response: Any) -> None:     def on_code_lens_capability_registered_async(self) -> None:         self._do_code_lenses_async() -    def _code_lens_key(self, index: int) -> str:-        return self.CODE_LENS_KEY + str(index)--    def _render_code_lens(self, name: str, index: int, region: sublime.Region, command: Optional[Command]) -> None:-        if command is not None:-            command_name = command.get("command")-            if command_name:-                annotation = make_command_link("lsp_execute", command["title"], {-                    "session_name": name,-                    "command_name": command_name,-                    "command_args": command.get("arguments")-                })-            else:-                annotation = command["title"]-        else:-            annotation = "..."-        annotation = '<div class="codelens">{}</div>'.format(annotation)-        accent = self.view.style_for_scope("region.greenish markup.accent.codelens.lsp")["foreground"]-        self.view.add_regions(self._code_lens_key(index), [region], "", "", 0, [annotation], accent)-     def _do_code_lenses_async(self) -> None:         session = self.session_async("codeLensProvider")         if session and session.uses_plugin():-            params = {"textDocument": text_document_identifier(self.view)}             for sv in self.session_views_async():                 if sv.session == session:-                    for request_id, request in sv.active_requests.items():-                        if request.method == "codeAction/resolve":-                            session.send_notification(Notification("$/cancelRequest", {"id": request_id}))-            name = session.config.name-            session.send_request_async(-                Request("textDocument/codeLens", params, self.view),-                lambda r: self._on_code_lenses_async(name, r))--    def _on_code_lenses_async(self, name: str, response: Optional[List[CodeLens]]) -> None:-        for i in range(0, len(self._code_lenses)):-            self.view.erase_regions(self._code_lens_key(i))-        self._code_lenses.clear()-        if not isinstance(response, list):-            return-        for index, c in enumerate(response):-            region = range_to_region(Range.from_lsp(c["range"]), self.view)-            self._code_lenses.append((c, region))-            if "command" in c:-                # We consider a code lens that has a command to be already resolved.-                self._on_resolved_code_lens_async(name, index, region, c)-            else:-                self._render_code_lens(name, index, region, None)-        self._code_lenses = list((c, range_to_region(Range.from_lsp(c["range"]), self.view)) for c in response)-        self._resolve_visible_code_lenses_async()+                    sv.start_code_lenses_async()

Because the data is now stored in SessionView, can't we now request code lenses for all sessions attached to the view?

Rapptz

comment created time in 11 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def on_request_finished_async(self, request_id: int) -> None:     def on_request_progress(self, request_id: int, params: Dict[str, Any]) -> None:         ... +    def start_code_lenses_async(self) -> None:+        ...++    def resolve_visible_code_lenses_async(self) -> None:+        ...++    def get_resolved_code_lenses_for_region(self, region: sublime.Region) -> Generator[CodeLens, None, None]:+        ...+

I see. get_resolved_code_lenses_for_region is used in the text command. start_code_lenses_async and resolve_visible_code_lenses_async can go away.

Rapptz

comment created time in 12 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def on_request_finished_async(self, request_id: int) -> None:     def on_request_progress(self, request_id: int, params: Dict[str, Any]) -> None:         ... +    def start_code_lenses_async(self) -> None:+        ...++    def resolve_visible_code_lenses_async(self) -> None:+        ...++    def get_resolved_code_lenses_for_region(self, region: sublime.Region) -> Generator[CodeLens, None, None]:+        ...+

If they're not given a type error is given when you eventually access it down the chain since e.g. AbstractViewListener makes use of it and failing to meet that interface leads to a type error.

Rapptz

comment created time in 12 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def on_request_finished_async(self, request_id: int) -> None:     def on_request_progress(self, request_id: int, params: Dict[str, Any]) -> None:         ... +    def start_code_lenses_async(self) -> None:+        ...++    def resolve_visible_code_lenses_async(self) -> None:+        ...++    def get_resolved_code_lenses_for_region(self, region: sublime.Region) -> Generator[CodeLens, None, None]:+        ...+

BTW, you can run tox locally to check mypy and flake8.

Rapptz

comment created time in 12 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def on_request_finished_async(self, request_id: int) -> None:     def on_request_progress(self, request_id: int, params: Dict[str, Any]) -> None:         ... +    def start_code_lenses_async(self) -> None:+        ...++    def resolve_visible_code_lenses_async(self) -> None:+        ...++    def get_resolved_code_lenses_for_region(self, region: sublime.Region) -> Generator[CodeLens, None, None]:+        ...+

I don't think these methods are required to be declared here? You should be able to remove them and mypy won't complain.

Rapptz

comment created time in 12 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def _cleanup(self) -> None:         triggers = [trigger for trigger in triggers if 'server' not in trigger]         settings.set("auto_complete_triggers", triggers)         self._stored_region = sublime.Region(-1, -1)-        self._color_phantoms.update([])

I messed this up during a rebase when I was splitting up the PR, sorry. I've reverted it.

Rapptz

comment created time in 12 hours

Pull request review commentsublimelsp/LSP

Refactor code lenses

 def _cleanup(self) -> None:         triggers = [trigger for trigger in triggers if 'server' not in trigger]         settings.set("auto_complete_triggers", triggers)         self._stored_region = sublime.Region(-1, -1)-        self._color_phantoms.update([])

where did this line go?

Rapptz

comment created time in 12 hours

PullRequestEvent

PR closed sublimelsp/lsp_utils

Add tests

Depends on https://github.com/SublimeText/UnitTesting/pull/192

Fixes #69

+136 -16

1 comment

14 changed files

rchl

pr closed time in 15 hours

issue closedsublimelsp/LSP

global name 'path' is not defined

Describe the bug 截屏2021-06-19 18 17 12 截屏2021-06-19 18 18 02

Environment (please complete the following information):

  • OS: macOS 11
  • Sublime Text version: [e.g. 4085]
  • LSP version: [e.g. 1.0.12, run Package Control: List Packages to find the version]
  • Language servers used: [e.g. clangd, gopls, dart, Vetur, intelephense, HIE]

closed time in 15 hours

thep0y

issue commentsublimelsp/LSP

global name 'path' is not defined

Thanks for the report. Please run Package Control: Satisfy Dependencies and the problem should be fixed.

It works now.

thep0y

comment created time in 15 hours

issue commentsublimelsp/LSP

global name 'path' is not defined

Thanks for the report. Please run Package Control: Satisfy Dependencies and the problem should be fixed.

thep0y

comment created time in 15 hours

issue openedsublimelsp/LSP

global name 'path' is not defined

Describe the bug 截屏2021-06-19 18 17 12 截屏2021-06-19 18 18 02

Environment (please complete the following information):

  • OS: macOS 11
  • Sublime Text version: [e.g. 4085]
  • LSP version: [e.g. 1.0.12, run Package Control: List Packages to find the version]
  • Language servers used: [e.g. clangd, gopls, dart, Vetur, intelephense, HIE]

created time in 15 hours

PR opened sublimelsp/LSP

Refactor code lenses

This changes the following:

  • Code lens state is stored in its own class
  • Code lenses are moved to SessionView instead of DocumentSyncListener
  • The code lens debounce time is lowered to 300ms from 2300ms

I'm aware this is a big change. The development was discussed in the Discord server in preparation of allowing to render code lenses as phantoms. As a result the PR for that one is blocked until this one is finalised since it depends on the refactoring done here.

I tried my best to separate the code that dealt with the phantom representation but some of the data changes might still linger and seem bizarre.

+246 -129

0 comment

6 changed files

pr created time in 20 hours

created tagsublimelsp/LSP

tag4070-1.6.1

Client implementation of the Language Server Protocol for Sublime Text

created time in a day

push eventsublimelsp/LSP

Raoul Wols

commit sha 47a2523edeb79c37342a8aca5e48eaf377981017

Cut 1.6.1

view details

push time in a day