prepare for warnings with column numbers

Fennel doesn't yet support column numbers in its warnings, but I'm going
to attempt to add them in 1.5.4+. This code will take advantage of those
numbers if/when that happens.
This commit is contained in:
XeroOl 2025-04-11 22:24:59 -05:00
parent f129605630
commit 3fbad644a9

View File

@ -326,8 +326,8 @@ identifiers are declared / referenced in which places."
(call-me-to-reset-the-compiler)
(error "__NOT_AN_ERROR"))))
(λ warn [msg ?ast _file ?line]
(let [range (or (message.ast->range server file ?ast) (line+byte->range server file (or ?line 1) 0))]
(λ warn [msg ?ast _file ?line ?col]
(let [range (or (message.ast->range server file ?ast) (line+byte->range server file (or ?line 1) (or ?col 0)))]
(table.insert diagnostics
{:range range
:message msg