tools/internal/lsp
Muir Manders c6e1543aba internal/lsp: add struct literal field snippets
Now when you accept a struct literal field name completion, you will
get a snippet that includes the colon, a tab stop, and a comma if
the literal is multi-line. If you have "gopls.usePlaceholders"
enabled, you will get a placeholder with the field's type as well.

I pushed snippet generation into the "source" package so ast and type
info is available. This allows for smarter, more context aware snippet
generation. For example, this let me fix an issue with the function
snippets where "foo<>()" was completing to "foo(<>)()". Now we don't
add the function call snippet if the position is already in a CallExpr.

I also added a new "Insert" field to CompletionItem to store the plain
object name. This way, we don't have to undo label decorations when
generating the insert text for the completion response. I also changed
"filterText" to use this "Insert" field since you don't want the
filter text to include the extra label decorations.

Fixes golang/go#31556

Change-Id: I75266b2a4c0fe4036c44b315582f51738e464a39
GitHub-Last-Rev: 1ec28b2395c7bbe748940befe8c38579f5d75f61
GitHub-Pull-Request: golang/tools#89
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173577
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-29 17:59:36 +00:00
..
cache internal/lsp: fix stuck diagnostic messages 2019-04-25 21:19:06 +00:00
cmd internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
diff internal/lsp: normalise and make public diff<->edit conversions 2019-04-15 20:31:36 +00:00
protocol internal/lsp: fix typo on 'textDocument/foldingRange' method 2019-04-22 18:44:13 +00:00
snippet internal/lsp: introduce snippet builder object 2019-04-25 18:37:29 +00:00
source internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
testdata internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
tests internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
xlog internal/lsp: add the ability to log back to the client 2019-04-01 16:22:08 +00:00
code_action.go internal/lsp: run source.organizeImports on all codeActions 2019-04-16 21:54:00 +00:00
completion.go internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
definition.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00
diagnostics.go internal/lsp: add more error propagation and logging for analyses 2019-04-24 02:44:48 +00:00
format.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00
general.go internal/lsp: use ast.Nodes for hover information 2019-04-18 23:52:43 +00:00
highlight.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00
hover.go internal/lsp: support comments on hover for typenames, funcs, fields 2019-04-22 16:38:38 +00:00
lsp_test.go internal/lsp: add struct literal field snippets 2019-04-29 17:59:36 +00:00
server.go internal/lsp: fix typo on 'textDocument/foldingRange' method 2019-04-22 18:44:13 +00:00
signature_help.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00
symbols.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00
text_synchronization.go internal/lsp: add additional debug logging for diagnostics 2019-04-22 21:11:31 +00:00
util.go internal/lsp: refactor server.go to separate into LSP categories 2019-04-17 20:54:51 +00:00