golang.org/x/tools/gopls@v0.15.3/doc/features.md (about) 1 # Features 2 3 This document describes some of the features supported by `gopls`. It is 4 currently under construction, so, for a comprehensive list, see the 5 [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). 6 7 ## Special features 8 9 Here, only special features outside of the LSP are described. 10 11 ### Symbol Queries 12 13 Gopls supports some extended syntax for `workspace/symbol` requests, when using 14 the `fuzzy` symbol matcher (the default). Inspired by the popular fuzzy matcher 15 [FZF](https://github.com/junegunn/fzf), the following special characters are 16 supported within symbol queries: 17 18 | Character | Usage | Match | 19 | --------- | --------- | ------------ | 20 | `'` | `'abc` | exact | 21 | `^` | `^printf` | exact prefix | 22 | `$` | `printf$` | exact suffix | 23 24 ## Template Files 25 26 Gopls provides some support for Go template files, that is, files that 27 are parsed by `text/template` or `html/template`. 28 Gopls recognizes template files based on their file extension, which may be 29 configured by the 30 [`templateExtensions`](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#templateextensions-string) setting. 31 Making this list empty turns off template support. 32 33 In template files, template support works inside 34 the default `{{` delimiters. (Go template parsing 35 allows the user to specify other delimiters, but 36 gopls does not know how to do that.) 37 38 Gopls template support includes the following features: 39 + **Diagnostics**: if template parsing returns an error, 40 it is presented as a diagnostic. (Missing functions do not produce errors.) 41 + **Syntax Highlighting**: syntax highlighting is provided for template files. 42 + **Definitions**: gopls provides jump-to-definition inside templates, though it does not understand scoping (all templates are considered to be in one global scope). 43 + **References**: gopls provides find-references, with the same scoping limitation as definitions. 44 + **Completions**: gopls will attempt to suggest completions inside templates. 45 46 ### Configuring your editor 47 48 In addition to configuring `templateExtensions`, you may need to configure your 49 editor or LSP client to activate `gopls` for template files. For example, in 50 `VS Code` you will need to configure both 51 [`files.associations`](https://code.visualstudio.com/docs/languages/identifiers) 52 and `build.templateExtensions` (the gopls setting). 53 54 <!--TODO(rstambler): Automatically generate a list of supported features.--> 55