Skip to content

Commit

Permalink
Merge pull request #1065 from fuyu0425/hide-severity
Browse files Browse the repository at this point in the history
make lsp-bridge-diagnostic-hide-severities to works for list
  • Loading branch information
manateelazycat authored Oct 8, 2024
2 parents d1a785b + 4ba6209 commit c794e2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions core/fileaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,13 @@ def change_cursor(self, position):
def get_diagnostics_count(self):
return sum(len(diags) for diags in self.diagnostics.values())

def get_diagnostics(self):
def get_diagnostics(self, hide_severities=None):
diagnostics = []
diagnostic_count = 0
for server_name in self.diagnostics:
for diagnostic in self.diagnostics[server_name]:
if hide_severities and diagnostic["severity"] in hide_severities:
continue
diagnostic["server-name"] = server_name
diagnostics.append(diagnostic)

Expand All @@ -298,15 +300,15 @@ def get_diagnostics(self):

return diagnostics

def list_diagnostics(self):
def list_diagnostics(self, hide_severities):
diagnostic_count = 0
for server_name in self.diagnostics:
diagnostic_count += len(self.diagnostics[server_name])

if diagnostic_count == 0:
message_emacs("No diagnostics found.")
else:
eval_in_emacs("lsp-bridge-diagnostic--list", self.get_diagnostics())
eval_in_emacs("lsp-bridge-diagnostic--list", self.get_diagnostics(hide_severities))

def sort_diagnostic(self, diagnostic_a, diagnostic_b):
score_a = [diagnostic_a["range"]["start"]["line"],
Expand Down
2 changes: 1 addition & 1 deletion lsp-bridge-diagnostic.el
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ You can set this value with `(2 3 4) if you just need render error diagnostic."

(defun lsp-bridge-diagnostic-list ()
(interactive)
(lsp-bridge-call-file-api "list_diagnostics"))
(lsp-bridge-call-file-api "list_diagnostics" lsp-bridge-diagnostic-hide-severities))

(defun lsp-bridge-diagnostic--list (diagnostics)
(let ((filepath acm-backend-lsp-filepath)
Expand Down

0 comments on commit c794e2f

Please sign in to comment.