Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugin/session_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from ..protocol import TextDocumentSyncKind
from ..protocol import TextEdit
from ..protocol import UnchangedDocumentDiagnosticReport
from .api import AbstractPlugin
from .api import LspPlugin
from .code_lens import CodeLensCache
from .code_lens import LspToggleCodeLensesCommand
Expand Down Expand Up @@ -1043,9 +1044,15 @@ def resolve_visible_code_lenses_async(self, view: sublime.View) -> None:
Promise.all(promises).then(lambda _: self._on_visible_code_lenses_resolved_async())

def _filter_supported_code_lenses(self) -> list[ResolvedCodeLens]:
code_lenses_with_command = self._code_lenses.code_lenses_with_command()
if isinstance(self.session.plugin, AbstractPlugin):
# We can't filter out any commands, because we don't know which commands are handled by the
# AbstractPlugin.on_pre_server_command API method. Code lenses which are not handled by that method or by
# the server will be shown, but are not functional.
return code_lenses_with_command
supported_code_lenses: list[ResolvedCodeLens] = []
# Filter out CodeLenses with commands that are not handled by the language server or plugin
for code_lens in self._code_lenses.code_lenses_with_command():
for code_lens in code_lenses_with_command:
command_name = code_lens['command']['command']
if command_name in self._supported_commands:
supported_code_lenses.append(code_lens)
Expand Down
Loading