This document describes some of the features supported by gopls
. It is currently under construction, so, for a comprehensive list, see the Language Server Protocol.
Here, only special features outside of the LSP are described.
Gopls supports some extended syntax for workspace/symbol
requests, when using the fuzzy
symbol matcher (the default). Inspired by the popular fuzzy matcher FZF, the following special characters are supported within symbol queries:
Character | Usage | Match |
---|---|---|
' | 'abc | exact |
^ | ^printf | exact prefix |
$ | printf$ | exact suffix |
Gopls provides some support for Go template files, that is, files that are parsed by text/template
or html/template
. Gopls recognizes template files based on their file extension, which may be configured by the templateExtensions
setting. Making this list empty turns off template support.
In template files, template support works inside the default {{
delimiters. (Go template parsing allows the user to specify other delimiters, but gopls does not know how to do that.)
Gopls template support includes the following features:
In addition to configuring templateExtensions
, you may need to configure your editor or LSP client to activate gopls
for template files. For example, in VS Code
you will need to configure both files.associations
and build.templateExtensions
(the gopls setting).