Skip to content

Commit 30fbd83

Browse files
committed
src/goLanguageServer: enable tmpl (go template) processing
And narrow the set of file extensions to match the current gopls default (.tmpl and .gotmpl). We will keep working on settings plumbing. For #609 Change-Id: I8d613e52dc2eeecb072339d53624178a5ed01ecb Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/371914 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Peter Weinberger <[email protected]> Trust: Peter Weinberger <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 15a266b commit 30fbd83

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
## v0.30.0 - 14 Dec, 2021
2-
3-
<!-- TODO: Debug features -->
1+
## v0.30.0 - 16 Dec, 2021
42

53
A list of all issues and changes can be found in the [v0.30.0 milestone](https://github.com/golang/vscode-go/milestone/40) and [commit history](https://github.com/golang/vscode-go/compare/v0.29.0...v0.30.0).
64

@@ -21,6 +19,7 @@ A list of all issues and changes can be found in the [v0.30.0 milestone](https:/
2119
- Stop debugging when delve remote connection ends in `legacy` remote debugging. ([CL 366936](https://go-review.googlesource.com/c/vscode-go/+/366936/))
2220
- Allow users to debug with older versions of `dlv-dap`. ([Issue 1814](https://github.com/golang/vscode-go/issues/1814))
2321

22+
- Enabled Go template file processing. ([Issue 609](https://github.com/golang/vscode-go/issues/609)) By default, files with `.tmpl` and `.gotmpl` extension are treated as Go template files.
2423
- Include `Fuzz*` functions in Testing UI and adds test codelens. ([Issue 1794](https://github.com/golang/vscode-go/issues/1794)) <!-- CL 361935 -->
2524
- `gofumports` is pinned at `v0.1.1`. We plan to remove it from the recognized formatter tool list since [`gofumports` is officially deprecated](https://github.com/mvdan/gofumpt/releases/tag/v0.2.0) early next year.
2625
- Disabled separate linting if gopls's 'staticcheck' is enabled. ([Issue 1867](https://github.com/golang/vscode-go/issues/1867))

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@
154154
},
155155
{
156156
"id": "tmpl",
157-
"filenamePatterns": [
158-
"*.*tmpl"
157+
"extensions": [
158+
".tmpl",
159+
".gotmpl"
159160
],
160161
"aliases": [
161162
"Go Template File"

src/goLanguageServer.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,10 @@ export async function buildLanguageClient(cfg: BuildLanguageClientOption): Promi
491491
{ language: 'go', scheme: 'file' },
492492
{ language: 'go.mod', scheme: 'file' },
493493
{ language: 'go.sum', scheme: 'file' },
494-
{ language: 'go.work', scheme: 'file' }
494+
{ language: 'go.work', scheme: 'file' },
495+
{ language: 'tmpl', scheme: 'file' }
495496
];
496497

497-
// Let gopls know about .tmpl - this is experimental, so enable it only in the experimental mode now.
498-
if (isInPreviewMode()) {
499-
documentSelector.push({ language: 'tmpl', scheme: 'file' });
500-
}
501498
const c = new LanguageClient(
502499
'go', // id
503500
cfg.serverName, // name e.g. gopls

0 commit comments

Comments
 (0)