small changes

This commit is contained in:
XeroOl 2024-06-24 00:22:51 -05:00
parent 54014ff625
commit b11b5b7962
4 changed files with 25 additions and 22 deletions

View File

@ -6,7 +6,6 @@ packages:
- lua5.3
- lua5.4
- luajit
- luarocks
sources:
- https://git.sr.ht/~xerool/fennel-ls
tasks:

View File

@ -48,7 +48,7 @@ install: $(EXE)
mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/
test: $(EXE)
$(FENNEL) $(FENNELFLAGS) test/init.fnl
TESTING=1 $(FENNEL) $(FENNELFLAGS) test/init.fnl
ci:
$(MAKE) test LUA=lua5.1
@ -63,9 +63,12 @@ ci:
$(MAKE) FENNEL=./old-fennel deps
diff -r deps old-deps
diff -r fennel old-fennel
rm -rf old-deps
rm -f old-fennel
# luarocks
luarocks install rockspecs/fennel-ls-scm-4.rockspec --dev --tree my-test-tree
# test that luarocks builds properly
sudo apt install luarocks
luarocks install rockspecs/fennel-ls-scm-4.rockspec --dev --local
clean:
rm -f $(EXE)

View File

@ -159,13 +159,14 @@ WARNING: this is only used in the test code, not in the real language server"
word))))
(fn multi-sym-base [symbol]
(local symbol (tostring symbol))
(if (or (= symbol ".")
(= symbol "..")
(= symbol "...")
(= symbol ":")
(= symbol "?."))
(tostring symbol)
(pick-values 1 (: (tostring symbol) :match "[^.:]*"))))
symbol
(pick-values 1 (symbol:match "[^.:]*"))))
(λ type= [val typ]
(= (type val) typ))

View File

@ -3,22 +3,22 @@
(local {: create-client-with-files} (require :test.utils))
(fn find [diagnostics e]
"returns the index of the diagnostic "
(accumulate [result nil
i d (ipairs diagnostics)
&until result]
(if (and (or (= e.message nil)
(if (= (type e.message) "function")
(e.message d.message)
(= e.message d.message)))
(or (= e.code nil)
(= e.code d.code))
(or (= e.range nil)
(and (= e.range.start.line d.range.start.line)
(= e.range.start.character d.range.start.character)
(= e.range.end.line d.range.end.line)
(= e.range.end.character d.range.end.character))))
i)))
"returns the index of the diagnostic that matches `e`"
(accumulate [result nil
i d (ipairs diagnostics)
&until result]
(if (and (or (= e.message nil)
(if (= (type e.message) "function")
(e.message d.message)
(= e.message d.message)))
(or (= e.code nil)
(= e.code d.code))
(or (= e.range nil)
(and (= e.range.start.line d.range.start.line)
(= e.range.start.character d.range.start.character)
(= e.range.end.line d.range.end.line)
(= e.range.end.character d.range.end.character))))
i)))
(fn check [file-contents expected unexpected]
(let [{: diagnostics} (create-client-with-files file-contents)]