Skip to content

Commit

Permalink
Fix issue #983, remove code_action_has_valid_edits
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Jun 28, 2024
1 parent 17bad51 commit 4f0cd01
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions core/fileaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,23 +362,12 @@ def push_code_actions(self, actions, server_name, action_kind):

code_actions = self.get_code_actions()
if len(code_actions) > 0:
if self.code_action_has_valid_edits(code_actions):
eval_in_emacs("lsp-bridge-code-action--fix", code_actions, action_kind)
else:
message_emacs("Fantastic, your code looks great! No further actions needed!")
eval_in_emacs("lsp-bridge-code-action--fix", code_actions, action_kind)
elif self.get_diagnostics_count() > 0:
message_emacs("Please move cursor to error or warning, then execute 'lsp-bridge-code-action' again.")
else:
message_emacs("Fantastic, your code looks great! No further actions needed!")

def code_action_has_valid_edits(self, data):
for item in data:
if 'edit' in item:
for change in item['edit']['documentChanges']:
if change['edits']:
return True
return False

def get_code_actions(self):
code_actions = []
for server_name in self.code_actions:
Expand Down

0 comments on commit 4f0cd01

Please sign in to comment.