Open rchl opened 3 years ago
It's a code action actually. Changing bug description to reflect that.
:: --> rust-analyzer textDocument/codeAction(72): {'context': {'diagnostics': []}, 'range': {'end': {'character': 25, 'line': 22}, 'start': {'character': 25, 'line': 22}}, 'textDocument': {'uri': 'file:///.../rust-analyzer/lib/arena/src/map.rs'}}
:: <<< rust-analyzer 71: None
:: <<< rust-analyzer 72: [{'data': {'id': 'line_to_block:RefactorRewrite:0', 'codeActionParams': {'context': {'diagnostics': []}, 'range': {'end': {'character': 25, 'line': 22}, 'start': {'character': 25, 'line': 22}}, 'textDocument': {'uri': 'file:///.../rust-analyzer/lib/arena/src/map.rs'}}}, 'title': 'Replace line comments with a single block comment', 'kind': 'refactor.rewrite'}]
There is also a small issue with the annotation collapsing if hovered shortly after the document is modified. Possibly because internally we re-create it.
cannot reproduce because LSP no longer displays the 'Replace line comments with a single block comment' in the annotations.
I had to do a bit of a hack to reproduce but it still reproduces:
diff --git a/plugin/documents.py b/plugin/documents.py
index 243a443..3331045 100644
--- a/plugin/documents.py
+++ b/plugin/documents.py
@@ -636,10 +636,11 @@ class DocumentSyncListener(sublime_plugin.ViewEventListener, AbstractViewListene
return
diagnostics_by_config, covering = self.diagnostics_intersecting_async(self._stored_selection[0])
actions_manager \
- .request_for_region_async(self.view, covering, diagnostics_by_config, manual=False) \
+ .request_for_region_async(self.view, covering, diagnostics_by_config, manual=True) \
.then(self._on_code_actions)
def _on_code_actions(self, responses: List[CodeActionsByConfigName]) -> None:
+ responses = [(name, [actions[0]]) for name, actions in responses]
self._actions_by_config = responses
action_count = 0
first_action_title = ''
Describe the bug Clicking the code action annotation triggers document modification but the annotation does not get refreshed, still showing the old "suggestion" that does not do anything when clicking. The cursor has to be moved to update it.
To Reproduce Steps to reproduce the behavior:
Expected behavior The code action annotation should automatically update after document is changed.
Screenshots
https://user-images.githubusercontent.com/153197/122014134-29488c00-cdbf-11eb-9242-af065af07605.mov
Environment (please complete the following information):