Skip to content

Commit 6182906

Browse files
authored
Merge pull request #79 from bobrowadam/fix-diagnostics
Fix flymake and lsp-mode diagnostics tools
2 parents 3097b5a + 815be2a commit 6182906

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

eca-editor.el

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ If URI is nil find all diagnostics otherwise filter to that uri."
6262
(end-r (lsp-get range :end)))
6363
(push (list :uri uri
6464
:severity (eca-editor--lsp-to-eca-severity (lsp-get it :severity))
65-
:code (lsp-get it :code)
65+
:code (when-let ((code (lsp-get it :code)))
66+
(if (symbolp code)
67+
(symbol-name code)
68+
(format "%s" code)))
6669
:range (list :start (list :line (lsp-get start-r :line)
6770
:character (lsp-get start-r :character))
6871
:end (list :line (lsp-get end-r :line)
6972
:character (lsp-get end-r :character)))
70-
:source (lsp-get it :source)
73+
:source (when-let ((source (lsp-get it :source)))
74+
(if (symbolp source)
75+
(symbol-name source)
76+
(format "%s" source)))
7177
:message (lsp-get it :message))
7278
eca-diagnostics))
7379
lsp-diagnostics)))
@@ -91,12 +97,18 @@ If URI is nil find all diagnostics otherwise filter to that uri."
9197
(end-col (current-column)))
9298
(list :uri (eca--path-to-uri (buffer-file-name (flymake-diagnostic-buffer it)))
9399
:severity (eca-editor--flymake-to-eca-severity (flymake-diagnostic-type it))
94-
:code (flymake-diagnostic-code it)
100+
:code (when-let ((code (flymake-diagnostic-code it)))
101+
(if (symbolp code)
102+
(symbol-name code)
103+
(format "%s" code)))
95104
:range (list :start (list :line beg-line
96105
:character beg-col)
97106
:end (list :line end-line
98107
:character end-col))
99-
:source (flymake-diagnostic-backend it)
108+
:source (when-let ((backend (flymake-diagnostic-backend it)))
109+
(if (symbolp backend)
110+
(symbol-name backend)
111+
(format "%s" backend)))
100112
:message (flymake-diagnostic-text it)))))
101113
(flymake--project-diagnostics))))
102114

0 commit comments

Comments
 (0)