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

View File

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