Attention is currently required from: Suzy Mueller.
Hyang-Ah Hana Kim would like Suzy Mueller to review this change.
docs/features.md: discuss default formatting behavior and template support
We already have a section in the advanced.md doc abount default formatting
and imports behavior. I hope this additional reference helps users to discover
the control knob.
Didn't mention completion, diagnostics for Go template files yet.
We need to update the diagnostics section to discuss gopls's diagnostics
feature.
Updates golang/vscode-go#609
Change-Id: Ib2e695d847c56bd4f562d91d2938cb5c1a032764
---
M docs/features.md
A docs/images/gotmpl.gif
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/docs/features.md b/docs/features.md
index 1598ad4..61d8c8a 100644
--- a/docs/features.md
+++ b/docs/features.md
@@ -15,6 +15,7 @@
* [Find interface implementations](#find-interface-implementations)
* [Document outline](#document-outline)
* [Toggle between code and tests](#toggle-between-code-and-tests)
+* [Syntax Highlighting](#syntax-highlighting)
* [Code Editing](#code-editing)
* [Snippets](#snippets)
* [Format and organize imports](#format-and-organize-imports)
@@ -103,6 +104,19 @@
<div style="text-align: center;"><img src="images/toggletestfile.gif" alt="Toggle between reverse.go and reverse_test.go" style="width: 75%"> </div>
+
+## Syntax Highlighting
+
+The default syntax highlighting for Go files is implemented in Visual Studio Code using TextMate grammar, not by this extension.
+
+If you are using `gopls`, you can enable [Semantic Highlighting](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide), more accurate syntax highlighting based on semantic tokenization using `"gopls": { "ui.semanticTokens": true }`.
+
+### Go template syntax highlighting
+
+When `gopls`'s semantic tokens feature is enabled, `gopls` also provides semantic tokens for Go template files (language identifier: `gotmpl`). By default, the extension associates all `*.tmpl` or `*.gotmpl` files in the workspace with `gotmpl` language. But users can override the language mode by using Visual Studio Code's UI or the `"files.associations"` setting. See [Visual Studio Code's doc](https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file) for more details.
+
+<div style="text-align: center;"><img src="images/gotmpl.gif" alt="Toggle between reverse.go and reverse_test.go" style="width: 75%"> </div>
+
## Code Editing
### [Snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets)
@@ -115,13 +129,16 @@
Format code and organize imports, either manually or on save.
+The extension is configured to formats Go code, organizes imports, and removes unused imports by default. For different behavior, please override per-language default settings following [the instruction](https://github.com/golang/vscode-go/blob/master/docs/advanced.md#formatting-code-and-organizing-imports).
+
+When organizing imports, the imported packages are grouped in the default `goimports` style. In order to group some packages after 3rd-party packages, use [`"gopls": { "formatting.local": <comma-separated imports prefix>}`](https://github.com/golang/vscode-go/blob/master/docs/settings.md#formattinglocal).
+
#### Add import
-Manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from your `GOPATH` and module cache.
+The extension organizes imports automatically and can add missing imports if the package is present in your module cache already. However, you can also manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from module cache (or from your `GOPATH` in GOPATH mode).
<div style="text-align: center;"><img src="images/addimport.gif" alt="Add byte import to Go file" style="width: 75%"> </div>
-
### [Rename symbol](https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol)
Rename all occurrences of a symbol in your workspace.
diff --git a/docs/images/gotmpl.gif b/docs/images/gotmpl.gif
new file mode 100644
index 0000000..c8fdaed
--- /dev/null
+++ b/docs/images/gotmpl.gif
Binary files differ
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Suzy Mueller.
Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/f75ab6a4-bfe5-404a-8da8-740cdb7ff70c
Patch set 1:TryBot-Result +1
Attention is currently required from: Hyang-Ah Hana Kim.
4 comments:
File docs/features.md:
Patch Set #1, Line 112: , more
s/, more/for more
Remove "but"
Patch Set #1, Line 118: Toggle between reverse.go and reverse_test.go
This alt text does not match the gif.
Patch Set #1, Line 132: is configured to
remove "is configured to" or change "formats", "organizes" and "removes" to "format" "organize" and "remove"
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Hyang-Ah Hana Kim.
Hyang-Ah Hana Kim uploaded patch set #2 to this change.
docs/features.md: discuss default formatting behavior and template support
We already have a section in the advanced.md doc abount default formatting
and imports behavior. I hope this additional reference helps users to discover
the control knob.
Didn't mention completion, diagnostics for Go template files yet.
We need to update the diagnostics section to discuss gopls's diagnostics
feature.
Updates golang/vscode-go#609
Change-Id: Ib2e695d847c56bd4f562d91d2938cb5c1a032764
---
M docs/features.md
A docs/images/gotmpl.gif
2 files changed, 38 insertions(+), 2 deletions(-)
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Suzy Mueller.
5 comments:
Patchset:
Thanks!
File docs/features.md:
Patch Set #1, Line 112: , more
s/, more/for more
Done
Remove "but"
Done
Patch Set #1, Line 118: Toggle between reverse.go and reverse_test.go
This alt text does not match the gif.
lol. copy&paste error :-)
Patch Set #1, Line 132: is configured to
remove "is configured to" or change "formats", "organizes" and "removes" to "format" "organize" and […]
Done
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Suzy Mueller.
Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/f434888a-b8a6-4799-86a3-fd5d7fa61b99
Patch set 2:TryBot-Result +1
Attention is currently required from: Suzy Mueller.
Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/69059c88-6710-4d99-93a0-7c5a6f5e0616
Patch set 3:TryBot-Result +1
Attention is currently required from: Suzy Mueller.
Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/37350a85-bf64-4f00-82d1-ac4cd6c01dab
Patch set 4:TryBot-Result +1
Attention is currently required from: Suzy Mueller, Hyang-Ah Hana Kim.
Patch set 4:Code-Review +2
1 comment:
Patchset:
Do you really want to
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Suzy Mueller.
1 comment:
Patchset:
Do you really want to
It looks like Gerrit dropped part of your comment.
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.
Hyang-Ah Hana Kim submitted this change.
docs/features.md: discuss default formatting behavior and template support
We already have a section in the advanced.md doc abount default formatting
and imports behavior. I hope this additional reference helps users to discover
the control knob.
Didn't mention completion, diagnostics for Go template files yet.
We need to update the diagnostics section to discuss gopls's diagnostics
feature.
Updates golang/vscode-go#609
Change-Id: Ib2e695d847c56bd4f562d91d2938cb5c1a032764
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/380615
Trust: Hyang-Ah Hana Kim <hya...@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hya...@gmail.com>
TryBot-Result: kokoro <noreply...@google.com>
Reviewed-by: Peter Weinberger <p...@google.com>
---
M docs/features.md
A docs/images/gotmpl.gif
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/docs/features.md b/docs/features.md
index 1598ad4..e658933 100644
--- a/docs/features.md
+++ b/docs/features.md
@@ -15,6 +15,7 @@
* [Find interface implementations](#find-interface-implementations)
* [Document outline](#document-outline)
* [Toggle between code and tests](#toggle-between-code-and-tests)
+* [Syntax Highlighting](#syntax-highlighting)
* [Code Editing](#code-editing)
* [Snippets](#snippets)
* [Format and organize imports](#format-and-organize-imports)
@@ -103,6 +104,19 @@
<div style="text-align: center;"><img src="images/toggletestfile.gif" alt="Toggle between reverse.go and reverse_test.go" style="width: 75%"> </div>
+
+## Syntax Highlighting
+
+The default syntax highlighting for Go files is implemented in Visual Studio Code using TextMate grammar, not by this extension.
+
+If you are using `gopls`, you can enable [Semantic Highlighting](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide) for more accurate syntax highlighting based on semantic tokenization using `"gopls": { "ui.semanticTokens": true }`.
+
+### Go template syntax highlighting
+
+When `gopls`'s semantic tokens feature is enabled, `gopls` also provides semantic tokens for Go template files (language identifier: `gotmpl`). By default, the extension associates all `*.tmpl` or `*.gotmpl` files in the workspace with `gotmpl` language. Users can override the language mode by using Visual Studio Code's UI or the `"files.associations"` setting. See [Visual Studio Code's doc](https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file) for more details.
+
+<div style="text-align: center;"><img src="images/gotmpl.gif" alt="Enable Go template language support by changing the language ID" style="width: 75%"> </div>
+
## Code Editing
### [Snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets)
@@ -115,13 +129,16 @@
Format code and organize imports, either manually or on save.
+The extension formats Go code, organizes imports, and removes unused imports by default. For different behavior, please override per-language default settings following [the instruction](https://github.com/golang/vscode-go/blob/master/docs/advanced.md#formatting-code-and-organizing-imports).
+
+When organizing imports, the imported packages are grouped in the default `goimports` style. In order to group some packages after 3rd-party packages, use [`"gopls": { "formatting.local": <comma-separated imports prefix>}`](https://github.com/golang/vscode-go/blob/master/docs/settings.md#formattinglocal).
+
#### Add import
-Manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from your `GOPATH` and module cache.
+The extension organizes imports automatically and can add missing imports if the package is present in your module cache already. However, you can also manually add a new import to your file through the [`Go: Add Import`](commands.md#go-add-import) command. Available packages are offered from module cache (or from your `GOPATH` in GOPATH mode).
<div style="text-align: center;"><img src="images/addimport.gif" alt="Add byte import to Go file" style="width: 75%"> </div>
-
### [Rename symbol](https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol)
Rename all occurrences of a symbol in your workspace.
diff --git a/docs/images/gotmpl.gif b/docs/images/gotmpl.gif
new file mode 100644
index 0000000..c8fdaed
--- /dev/null
+++ b/docs/images/gotmpl.gif
Binary files differ
To view, visit change 380615. To unsubscribe, or for help writing mail filters, visit settings.