diff --git a/src/fennel-ls/diagnostics.fnl b/src/fennel-ls/diagnostics.fnl index 789aac2..7f4cf0d 100644 --- a/src/fennel-ls/diagnostics.fnl +++ b/src/fennel-ls/diagnostics.fnl @@ -84,7 +84,7 @@ the `file.diagnostics` field, filling it with diagnostics." :codeDescription "bad-unpack"}))) (λ var-never-set [self file symbol definition] - (if (and definition.var? (not definition.var-set)) + (if (and definition.var? (not definition.var-set) (. file.lexical symbol)) {:range (message.ast->range self file symbol) :message (.. "var is never set: " (tostring symbol) " Consider using (local) instead of (var)") :severity message.severity.WARN diff --git a/test/diagnostic.fnl b/test/diagnostic.fnl index 5c8c5c7..534e942 100644 --- a/test/diagnostic.fnl +++ b/test/diagnostic.fnl @@ -168,9 +168,8 @@ (check "(var x 1) (set x 2) (print x)" [] [{}]) - ;; TODO fix diagnostic - ; (check "(local x 10) (?. x)" - ; [] [{:code 305}]) + (check "(local x 10) (?. x)" + [] [{:code 305}]) nil) ;; missing test for 306