diff --git a/go.mod b/go.mod index 3a8c078a37..0619c232aa 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( github.com/tilt-dev/go-get v0.2.3 github.com/tilt-dev/localregistry-go v0.0.0-20201021185044-ffc4c827f097 github.com/tilt-dev/probe v0.3.1 - github.com/tilt-dev/starlark-lsp v0.0.0-20220812175527-c0c1958f8166 + github.com/tilt-dev/starlark-lsp v0.0.0-20230210155543-84c13fe0ff94 github.com/tilt-dev/tilt-apiserver v0.8.0 github.com/tilt-dev/wmclient v0.0.0-20201109174454-1839d0355fbc github.com/tonistiigi/fsutil v0.0.0-20210609172227-d72af97c0eaf diff --git a/go.sum b/go.sum index 523a0a82f8..570dce4a64 100644 --- a/go.sum +++ b/go.sum @@ -1299,8 +1299,8 @@ github.com/tilt-dev/localregistry-go v0.0.0-20201021185044-ffc4c827f097 h1:CiCHb github.com/tilt-dev/localregistry-go v0.0.0-20201021185044-ffc4c827f097/go.mod h1:SX7bKYACP+RsddxA+NBkfVzr5DOr5ranTirgT7xlxjA= github.com/tilt-dev/probe v0.3.1 h1:PQhXSBkgcGBUU/eKt4vgAUKsAWWjBr2F53xNAc0E7zs= github.com/tilt-dev/probe v0.3.1/go.mod h1:F53NFbqblwu5oyIk2t+BPkswiboxuF8e5D3wbPnY4JA= -github.com/tilt-dev/starlark-lsp v0.0.0-20220812175527-c0c1958f8166 h1:q8XpS99WmxxaAE9A088mcigxllgyJ1skLJ86bIORbEQ= -github.com/tilt-dev/starlark-lsp v0.0.0-20220812175527-c0c1958f8166/go.mod h1:bnkWmNDRqs9DgHgrImOSt6dFAcVcN14pqhR3iZsWWaE= +github.com/tilt-dev/starlark-lsp v0.0.0-20230210155543-84c13fe0ff94 h1:IV0e4/w6PswnHdVmAZ6Ipo8ZdgaPn1nWTNR7Sd2LETo= +github.com/tilt-dev/starlark-lsp v0.0.0-20230210155543-84c13fe0ff94/go.mod h1:bnkWmNDRqs9DgHgrImOSt6dFAcVcN14pqhR3iZsWWaE= github.com/tilt-dev/tilt-apiserver v0.8.0 h1:Ue652PTiA3GBPEYLJ2nJhdxCzqTEOtSbYic5ZubhpZc= github.com/tilt-dev/tilt-apiserver v0.8.0/go.mod h1:BR3Zqt5V+4hXTkCYGRST2jZjFNrBxOa4X0sGUsR6Obw= github.com/tilt-dev/wmclient v0.0.0-20201109174454-1839d0355fbc h1:wGkAoZhrvnmq93B4W2v+agiPl7xzqUaxXkxmKrwJ6bc= diff --git a/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/hover.go b/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/hover.go index 26648ad934..fd34029293 100644 --- a/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/hover.go +++ b/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/hover.go @@ -26,7 +26,7 @@ func (a *Analyzer) Hover(ctx context.Context, doc document.Document, pos protoco result := &protocol.Hover{ Range: &r, Contents: protocol.MarkupContent{ - Kind: protocol.PlainText, + Kind: protocol.Markdown, Value: symbol.Detail, }, } diff --git a/vendor/github.com/tilt-dev/starlark-lsp/pkg/docstring/docstring.go b/vendor/github.com/tilt-dev/starlark-lsp/pkg/docstring/docstring.go index 80ef4ed91d..d6be3eab1c 100644 --- a/vendor/github.com/tilt-dev/starlark-lsp/pkg/docstring/docstring.go +++ b/vendor/github.com/tilt-dev/starlark-lsp/pkg/docstring/docstring.go @@ -388,7 +388,9 @@ func parseBlockTitle(l string) (title string, ok bool) { } // fieldRe matches "field: ...". -var fieldRe = regexp.MustCompile(`^(\S*)\s*:\s*(.*)$`) +// +// fieldRe matches arguments in docstrings, allowing spaces around the name and type +var fieldRe = regexp.MustCompile(`^(\S.*?)\s*:\s*(.*)$`) // parseFieldLine recognized strings like "field*:*...". // diff --git a/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/signature.go b/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/signature.go index acf72c0f38..5d10df5c4a 100644 --- a/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/signature.go +++ b/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/signature.go @@ -99,10 +99,23 @@ func (s Signature) Label() string { } func (s Signature) Symbol() Symbol { + argsList := []string{} + returns := s.Docs.Returns() + for _, arg := range s.Docs.Args() { + argsList = append(argsList, fmt.Sprintf("%s: %s", arg.Name, arg.Desc)) + } + argsFormatted := strings.Join(argsList, "\\\n") + detail := s.Docs.Description + if len(argsFormatted) > 0 { + detail += fmt.Sprintf("\n## Parameters\n%s", argsFormatted) + } + if len(returns) > 0 { + detail += fmt.Sprintf("\n## Returns\n%s", returns) + } return Symbol{ Name: s.Name, Kind: protocol.SymbolKindFunction, - Detail: s.Docs.Description, + Detail: detail, Location: protocol.Location{ URI: s.docURI, Range: s.Range, diff --git a/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/symbol.go b/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/symbol.go index 035f8bd67c..2da78bc62d 100644 --- a/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/symbol.go +++ b/vendor/github.com/tilt-dev/starlark-lsp/pkg/query/symbol.go @@ -21,7 +21,6 @@ func SiblingSymbols(doc DocumentContent, node, before *sitter.Node) []Symbol { case NodeTypeFunctionDef: sig := ExtractSignature(doc, n) symbol = sig.Symbol() - symbol.Detail = sig.Docs.Description } if symbol.Name != "" { diff --git a/vendor/modules.txt b/vendor/modules.txt index c6fbcd855c..5830e27cb9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -680,7 +680,7 @@ github.com/tilt-dev/localregistry-go github.com/tilt-dev/probe/internal/procutil github.com/tilt-dev/probe/pkg/probe github.com/tilt-dev/probe/pkg/prober -# github.com/tilt-dev/starlark-lsp v0.0.0-20220812175527-c0c1958f8166 +# github.com/tilt-dev/starlark-lsp v0.0.0-20230210155543-84c13fe0ff94 ## explicit; go 1.19 github.com/tilt-dev/starlark-lsp/pkg/analysis github.com/tilt-dev/starlark-lsp/pkg/cli