Add selfcheck make target.
Also cleans up repeated path options in the makefile, and cleans up warnings where fennel-ls warns on itself. There were some unused functions; I just put a _ before their name but that might be a bit silly. Maybe they should be removed? Or just left alone?
This commit is contained in:
parent
b861812b24
commit
4a121f70b0
14
Makefile
14
Makefile
@ -10,23 +10,22 @@ DESTDIR ?=
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
|
||||
.PHONY: clean test install ci
|
||||
OPTS=--add-package-path "./src/?.lua" --add-fennel-path "./src/?.fnl"
|
||||
|
||||
.PHONY: clean test install ci selfcheck
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
$(EXE): $(SRC)
|
||||
echo "#!/usr/bin/env $(LUA)" > $@
|
||||
LUA_PATH="./src/?.lua" \
|
||||
FENNEL_PATH="./src/?.fnl" \
|
||||
$(FENNEL) --require-as-include --compile src/fennel-ls.fnl >> $@
|
||||
$(FENNEL) $(OPTS) --require-as-include --compile src/fennel-ls.fnl >> $@
|
||||
chmod 755 $@
|
||||
|
||||
clean:
|
||||
rm -f $(EXE)
|
||||
|
||||
test:
|
||||
TESTING=1 LUA_PATH="./src/?.lua;./?.lua" FENNEL_PATH="./src/?.fnl;./?.fnl" \
|
||||
$(FENNEL) test/init.fnl
|
||||
TESTING=1 $(FENNEL) $(OPTS) test/init.fnl
|
||||
|
||||
testall:
|
||||
$(MAKE) test LUA=lua5.1
|
||||
@ -39,3 +38,6 @@ install: $(EXE)
|
||||
mkdir -p $(DESTDIR)$(BINDIR) && cp $< $(DESTDIR)$(BINDIR)/
|
||||
|
||||
ci: testall $(EXE)
|
||||
|
||||
selfcheck:
|
||||
$(FENNEL) $(OPTS) src/fennel-ls.fnl --check $(SRC)
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
(local json-rpc (require :fennel-ls.json-rpc))
|
||||
(local state (require :fennel-ls.state))
|
||||
(local diagnostics (require :fennel-ls.diagnostics))
|
||||
(local {: view} (require :fennel))
|
||||
|
||||
(λ check [filename]
|
||||
(let [server (doto {}
|
||||
|
||||
@ -3,7 +3,7 @@ This file is responsible for the low level tasks of analysis. Its main job
|
||||
is to recieve a file object and run all of the basic analysis that will be used
|
||||
later by fennel-ls.language to answer requests from the client."
|
||||
|
||||
(local {: sym? : list? : sequence? : table? : sym : view &as fennel} (require :fennel))
|
||||
(local {: sym? : list? : sequence? : table? : sym &as fennel} (require :fennel))
|
||||
(local message (require :fennel-ls.message))
|
||||
(local utils (require :fennel-ls.utils))
|
||||
(local searcher (require :fennel-ls.searcher))
|
||||
@ -122,7 +122,7 @@ later by fennel-ls.language to answer requests from the client."
|
||||
(table.remove keys))))))
|
||||
(recurse binding []))
|
||||
|
||||
(λ mutate [?definition binding scope]
|
||||
(λ mutate [_?definition binding scope]
|
||||
;; for now, mutating a field counts as a reference I guess
|
||||
(λ recurse [binding keys]
|
||||
(if (sym? binding)
|
||||
@ -196,7 +196,7 @@ later by fennel-ls.language to answer requests from the client."
|
||||
(define (sym :nil) binding scope))
|
||||
|
||||
(λ compile-each [ast bindings scope]
|
||||
(each [i binding (ipairs bindings)]
|
||||
(each [_ binding (ipairs bindings)]
|
||||
(define (sym :nil) binding scope)))
|
||||
|
||||
(λ compile-fn [ast scope]
|
||||
@ -270,7 +270,7 @@ later by fennel-ls.language to answer requests from the client."
|
||||
(table.insert allowed-globals :love)
|
||||
|
||||
;; TODO clean up this code. It's awful now that there is error handling
|
||||
(let [macro-file? (= (: file.text :sub 1 24) ";; fennel-ls: macro-file")
|
||||
(let [macro-file? (= (file.text:sub 1 24) ";; fennel-ls: macro-file")
|
||||
plugin
|
||||
{:name "fennel-ls"
|
||||
:versions ["1.3.2"]
|
||||
|
||||
@ -12,8 +12,6 @@ Every time the client sends a message, it gets handled by a function in the corr
|
||||
(local formatter (require :fennel-ls.formatter))
|
||||
(local utils (require :fennel-ls.utils))
|
||||
|
||||
(local {: view} (require :fennel))
|
||||
|
||||
(local requests [])
|
||||
(local notifications [])
|
||||
|
||||
@ -168,7 +166,7 @@ Every time the client sends a message, it gets handled by a function in the corr
|
||||
_ {: label :kind kinds.Field}))))
|
||||
_ nil))))
|
||||
|
||||
(λ create-completion-item [self file name scope]
|
||||
(λ _create-completion-item [self file name scope]
|
||||
(let [result (language.search-name-and-scope self file name scope)]
|
||||
{:label result.label :kind result.kind}))
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
The high level analysis system that does deep searches following
|
||||
the data provided by compiler.fnl."
|
||||
|
||||
(local {: sym? : list? : sequence? : varg? : sym : view} (require :fennel))
|
||||
(local {: sym? : list? : sequence? : varg? : sym} (require :fennel))
|
||||
(local utils (require :fennel-ls.utils))
|
||||
(local state (require :fennel-ls.state))
|
||||
|
||||
@ -169,7 +169,7 @@ Returns:
|
||||
_ (case (find-local-definition file name scope)
|
||||
def (search self file def.definition (stack-add-keys! stack def.keys) (or ?opts {})))))))
|
||||
|
||||
(λ past? [?ast byte]
|
||||
(λ _past? [?ast byte]
|
||||
;; check if a byte is past an ast object
|
||||
(and (= (type ?ast) :table)
|
||||
(get-ast-info ?ast :bytestart)
|
||||
@ -185,7 +185,7 @@ Returns:
|
||||
byte
|
||||
(+ 1 (utils.get-ast-info ?ast :byteend)))))
|
||||
|
||||
(λ does-not-contain? [?ast byte]
|
||||
(λ _does-not-contain? [?ast byte]
|
||||
;; check if a byte is in range of the ast
|
||||
(and (= (type ?ast) :table)
|
||||
(get-ast-info ?ast :bytestart)
|
||||
@ -206,7 +206,7 @@ Returns:
|
||||
(if
|
||||
(or (sequence? ast) (list? ast))
|
||||
(accumulate [(result done) nil
|
||||
i child (ipairs ast)
|
||||
_ child (ipairs ast)
|
||||
&until result]
|
||||
(if (contains? child byte)
|
||||
(recurse child byte)))
|
||||
@ -219,7 +219,7 @@ Returns:
|
||||
(contains? value byte)
|
||||
(recurse value byte)))))))
|
||||
(values
|
||||
(accumulate [result nil i top-level-form (ipairs ast) &until result]
|
||||
(accumulate [result nil _ top-level-form (ipairs ast) &until result]
|
||||
(if (contains? top-level-form byte)
|
||||
(recurse top-level-form byte)))
|
||||
(fcollect [i 1 (length parents)]
|
||||
|
||||
@ -21,7 +21,7 @@ in the \"self\" object."
|
||||
(tset self.files uri file)
|
||||
file)))
|
||||
|
||||
(λ get-by-path [self path]
|
||||
(λ _get-by-path [self path]
|
||||
(get-by-uri self (utils.path->uri path)))
|
||||
|
||||
(λ get-by-module [self module]
|
||||
|
||||
@ -13,7 +13,7 @@ These functions are all pure functions, which makes me happy."
|
||||
(λ next-lines [str nlines ?from]
|
||||
"Find the start of the next line from a given byte offset, or from the start of the string."
|
||||
(faccumulate [from (or ?from 1)
|
||||
i 1 nlines]
|
||||
_ 1 nlines]
|
||||
(next-line str from)))
|
||||
|
||||
(fn utf [byte]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user