Skip to content

Commit

Permalink
src/goLanguageServer: enable tmpl (go template) processing
Browse files Browse the repository at this point in the history
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 <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
  • Loading branch information
hyangah committed Dec 14, 2021
1 parent 15a266b commit 30fbd83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## v0.30.0 - 14 Dec, 2021

<!-- TODO: Debug features -->
## v0.30.0 - 16 Dec, 2021

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).

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

- 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.
- Include `Fuzz*` functions in Testing UI and adds test codelens. ([Issue 1794](https://github.com/golang/vscode-go/issues/1794)) <!-- CL 361935 -->
- `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.
- Disabled separate linting if gopls's 'staticcheck' is enabled. ([Issue 1867](https://github.com/golang/vscode-go/issues/1867))
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@
},
{
"id": "tmpl",
"filenamePatterns": [
"*.*tmpl"
"extensions": [
".tmpl",
".gotmpl"
],
"aliases": [
"Go Template File"
Expand Down
7 changes: 2 additions & 5 deletions src/goLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,10 @@ export async function buildLanguageClient(cfg: BuildLanguageClientOption): Promi
{ language: 'go', scheme: 'file' },
{ language: 'go.mod', scheme: 'file' },
{ language: 'go.sum', scheme: 'file' },
{ language: 'go.work', scheme: 'file' }
{ language: 'go.work', scheme: 'file' },
{ language: 'tmpl', scheme: 'file' }
];

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

0 comments on commit 30fbd83

Please # to comment.