Docs when completing string fields

This commit is contained in:
XeroOl 2024-05-04 14:10:50 -05:00
parent de7ca2a5c1
commit 926dff9267
2 changed files with 19 additions and 8 deletions

View File

@ -5,13 +5,14 @@ Every time the client sends a message, it gets handled by a function in the corr
(ie, a textDocument/didChange notification will call notifications.textDocument/didChange (ie, a textDocument/didChange notification will call notifications.textDocument/didChange
and a textDocument/defintion request will call requests.textDocument/definition)" and a textDocument/defintion request will call requests.textDocument/definition)"
(local lint (require :fennel-ls.lint)) (local lint (require :fennel-ls.lint))
(local message (require :fennel-ls.message)) (local message (require :fennel-ls.message))
(local state (require :fennel-ls.state)) (local state (require :fennel-ls.state))
(local language (require :fennel-ls.language)) (local language (require :fennel-ls.language))
(local formatter (require :fennel-ls.formatter)) (local formatter (require :fennel-ls.formatter))
(local utils (require :fennel-ls.utils)) (local utils (require :fennel-ls.utils))
(local fennel (require :fennel)) (local docs (require :fennel-ls.docs))
(local fennel (require :fennel))
(local requests []) (local requests [])
(local notifications []) (local notifications [])
@ -161,8 +162,8 @@ Every time the client sends a message, it gets handled by a function in the corr
{: definition : file} {: definition : file}
(case (values definition (type definition)) (case (values definition (type definition))
;; fields of a string are hardcoded to "string" ;; fields of a string are hardcoded to "string"
(_str :string) (icollect [label _ (pairs string)] (_str :string) (icollect [label info (pairs (. (docs.get-global-metadata :string) :fields))]
{: label :kind kinds.Field}) (formatter.completion-item-format label info))
;; fields of a table ;; fields of a table
(tbl :table) (let [keys []] (tbl :table) (let [keys []]
(icollect [label _ (pairs tbl) &into keys] (icollect [label _ (pairs tbl) &into keys]

View File

@ -206,6 +206,16 @@
{:kind #(= nil $)} {:kind #(= nil $)}
{:label #(= nil $)}]) {:label #(= nil $)}])
(check "(let [x :hi]
(x.|))"
[:gsub
:gmatch
:match
:sub
:len
:find]
[{:documentation #(= nil $)}])
nil) nil)
(fn test-module [] (fn test-module []