Multivals ruining everything
This commit is contained in:
parent
b2c3c04bfe
commit
91d4e1e410
@ -37,6 +37,9 @@ later by fennel-ls.language to answer requests from the client."
|
||||
(tset self key val)
|
||||
val))})
|
||||
|
||||
(λ is-values? [?ast]
|
||||
(and (list? ?ast) (= (sym :values) (. ?ast 1))))
|
||||
|
||||
(λ compile [self file]
|
||||
"Compile the file, and record all the useful information from the compiler into the file object"
|
||||
;; The useful information being recorded:
|
||||
@ -107,6 +110,13 @@ later by fennel-ls.language to answer requests from the client."
|
||||
(. keys i)))}]
|
||||
(tset (. definitions-by-scope scope) (tostring binding) definition)
|
||||
(tset definitions binding definition))
|
||||
(list? binding)
|
||||
(if (and (is-values? ?definition)
|
||||
(= (length binding)
|
||||
(- (length ?definition) 1)))
|
||||
(for [i 1 (length binding)]
|
||||
(define (. ?definition (+ i 1)) (. binding i) scope))
|
||||
(recurse (. binding 1) keys))
|
||||
(= :table (type binding))
|
||||
(each [k v (iter binding)]
|
||||
(table.insert keys k)
|
||||
|
||||
@ -133,7 +133,7 @@ Every time the client sends a message, it gets handled by a function in the corr
|
||||
:Snippet 15 :Color 16 :File 17 :Reference 18 :Folder 19 :EnumMember 20
|
||||
:Constant 21 :Struct 22 :Event 23 :Operator 24 :TypeParameter 25})
|
||||
|
||||
(λ make-completionitem [self file name scope]
|
||||
(λ make-completion-item [self file name scope]
|
||||
;; TODO consider passing stop-early?
|
||||
(case (language.search-name-and-scope self file name scope)
|
||||
def (formatter.completion-item-format name def)))
|
||||
@ -147,7 +147,7 @@ Every time the client sends a message, it gets handled by a function in the corr
|
||||
?parent (. parents 1)
|
||||
result []
|
||||
in-call-position? (and ?parent (= ?symbol (. ?parent 1)))]
|
||||
(collect-scope scope :manglings #(make-completionitem self file $ scope) result)
|
||||
(collect-scope scope :manglings #(make-completion-item self file $ scope) result)
|
||||
(when in-call-position?
|
||||
(collect-scope scope :macros #{:label $ :kind kinds.Keyword} result)
|
||||
(collect-scope scope :specials #{:label $ :kind kinds.Keyword} result))
|
||||
|
||||
@ -114,11 +114,10 @@
|
||||
(let [client (doto (create-client)
|
||||
(: :open-file! filename "(fn xyzzy [x y z] \"docstring\" nil)\n(xyzz"))
|
||||
[{:result [completion]}] (client:completion filename 1 5)]
|
||||
(print (view completion))
|
||||
(assert completion.label "completion label")
|
||||
(assert completion.kind "completion kind")
|
||||
;; (assert (?. completion :labelDetails :description) "fully qualified names or file path")
|
||||
(assert completion.documentation "completion documentation")))))
|
||||
;; TODO this seems a little bit weird to assert
|
||||
(is.same :xyzzy completion.label "the first completion should be xyzzy")
|
||||
(assert completion.kind "completion kind should be present")
|
||||
(assert completion.documentation "completion documentation should be present")))))
|
||||
|
||||
;; (it "offers rich information about macro completions")
|
||||
;; (it "offers rich information about variable completions")
|
||||
|
||||
@ -46,4 +46,7 @@
|
||||
(it "hovers over literally the very first character"
|
||||
(let [self (create-client)
|
||||
message (self:hover (.. ROOT-URI "/hover.fnl") 0 0)]
|
||||
(is-matching message [{:jsonrpc "2.0" :id 2}] ""))))
|
||||
(is-matching message [{:jsonrpc "2.0" :id 2}] "")))
|
||||
|
||||
(it "can go backward through (case)"
|
||||
(check "hover.fnl" 22 22 "```fnl\n{:AB :CD}\n```")))
|
||||
|
||||
@ -18,3 +18,6 @@
|
||||
nil)
|
||||
|
||||
(lambda-fn 1 2)
|
||||
|
||||
(case {:x [10 {:AB :CD}]}
|
||||
{:x [_ val]} (print val))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user