gopls/doc/assets: create dummy submodule for image files Contra the previous CL, we decided to store the PNG images in git, but in a separate submodule so that we don't bloat the gopls module download. (These images will also be shared with forthcoming gopls docs in CL 583316.) Change-Id: I5bab6114ce10304725ba2ac58a8654c247171801 Reviewed-on: https://go-review.googlesource.com/c/tools/+/593675 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/gopls/doc/assets/assets.go b/gopls/doc/assets/assets.go new file mode 100644 index 0000000..6fef4a8 --- /dev/null +++ b/gopls/doc/assets/assets.go
@@ -0,0 +1,3 @@ +// Package assets is an empty package to appease "go test ./...", +// as run by our CI builders, which doesn't like an empty module. +package assets
diff --git a/gopls/doc/assets/browse-assembly.png b/gopls/doc/assets/browse-assembly.png new file mode 100644 index 0000000..93ae8d2 --- /dev/null +++ b/gopls/doc/assets/browse-assembly.png Binary files differ
diff --git a/gopls/doc/assets/browse-free-symbols.png b/gopls/doc/assets/browse-free-symbols.png new file mode 100644 index 0000000..c521f52 --- /dev/null +++ b/gopls/doc/assets/browse-free-symbols.png Binary files differ
diff --git a/gopls/doc/assets/browse-pkg-doc.png b/gopls/doc/assets/browse-pkg-doc.png new file mode 100644 index 0000000..32db616 --- /dev/null +++ b/gopls/doc/assets/browse-pkg-doc.png Binary files differ
diff --git a/gopls/doc/assets/code-action-doc.png b/gopls/doc/assets/code-action-doc.png new file mode 100644 index 0000000..2f2e6e4 --- /dev/null +++ b/gopls/doc/assets/code-action-doc.png Binary files differ
diff --git a/gopls/doc/assets/go.mod b/gopls/doc/assets/go.mod new file mode 100644 index 0000000..73f4969 --- /dev/null +++ b/gopls/doc/assets/go.mod
@@ -0,0 +1,7 @@ +// This module contains no Go code, but serves to carve out a hole in +// its parent module to avoid bloating it with large image files that +// would otherwise be dowloaded by "go install golang.org/x/tools/gopls@latest". + +module golang.org/x/tools/gopls/doc/assets + +go 1.19
diff --git a/gopls/doc/assets/hover-doclink.png b/gopls/doc/assets/hover-doclink.png new file mode 100644 index 0000000..dcee92b --- /dev/null +++ b/gopls/doc/assets/hover-doclink.png Binary files differ
diff --git a/gopls/doc/assets/hover-field-tag.png b/gopls/doc/assets/hover-field-tag.png new file mode 100644 index 0000000..f36640c --- /dev/null +++ b/gopls/doc/assets/hover-field-tag.png Binary files differ
diff --git a/gopls/doc/assets/hover-size-field.png b/gopls/doc/assets/hover-size-field.png new file mode 100644 index 0000000..090d0ff --- /dev/null +++ b/gopls/doc/assets/hover-size-field.png Binary files differ
diff --git a/gopls/doc/assets/hover-size-struct.png b/gopls/doc/assets/hover-size-struct.png new file mode 100644 index 0000000..4af9a33 --- /dev/null +++ b/gopls/doc/assets/hover-size-struct.png Binary files differ
diff --git a/gopls/doc/assets/hover-size-wasteful.png b/gopls/doc/assets/hover-size-wasteful.png new file mode 100644 index 0000000..6d907fb --- /dev/null +++ b/gopls/doc/assets/hover-size-wasteful.png Binary files differ
diff --git a/gopls/doc/release/v0.16.0.md b/gopls/doc/release/v0.16.0.md index 68a46fb..1bcb5ec 100644 --- a/gopls/doc/release/v0.16.0.md +++ b/gopls/doc/release/v0.16.0.md
@@ -85,7 +85,7 @@ even ones that have not yet been saved. Reload the page after an edit to see updated documentation. -<img title="Browse documentation for package" src="../features/code-action-doc.png" width="80%"> +<img title="Browse documentation for package" src="../assets/code-action-doc.png" width="80%"> As in `pkg.go.dev`, the heading for each symbol contains a link to the source code of its declaration. In `pkg.go.dev`, these links would refer @@ -94,7 +94,7 @@ cause your editor to navigate to the declaration. (This feature requires that your LSP client honors the `showDocument` downcall.) -<img title="Symbol links navigate your editor to the declaration" src="../features/browse-pkg-doc.png" width="80%"> +<img title="Symbol links navigate your editor to the declaration" src="../assets/browse-pkg-doc.png" width="80%"> Editor support: - VS Code: use the "Source action > Browse documentation for func fmt.Println" menu item. @@ -130,7 +130,7 @@ function's parameters is used, allowing you to simplify and generalize the function by choosing a different type for that parameter. -<img title="Browse free symbols" src="../features/browse-free-symbols.png" width="80%"> +<img title="Browse free symbols" src="../assets/browse-free-symbols.png" width="80%"> Editor support: - VS Code: use the `Source action > Browse free symbols` menu item. @@ -151,7 +151,7 @@ This is usually the same as your machine's GOARCH unless you are working in a file with `go:build` tags for a different architecture. -<img title="Browse assembly for function" src="../features/browse-assembly.png" width="80%"> +<img title="Browse assembly for function" src="../assets/browse-assembly.png" width="80%"> Gopls cannot yet display assembly for generic functions: generic functions are not fully compiled until they are instantiated, @@ -240,16 +240,16 @@ Hovering over the identifier that declares a type or struct field now displays the size information for the type: -<img title="struct size info" src="../features/hover-size-struct.png"> +<img title="struct size info" src="../assets/hover-size-struct.png"> and the offset information for the field: -<img title="field size/offset info" src="../features/hover-size-field.png"> +<img title="field size/offset info" src="../assets/hover-size-field.png"> In addition, it reports the percentage of wasted space due to suboptimal ordering of struct fields, if this figure is 20% or higher: -<img title="a struct with wasted space" src="../features/hover-size-wasteful.png"> +<img title="a struct with wasted space" src="../assets/hover-size-wasteful.png"> In the struct above, alignment rules require each of the two boolean fields (1 byte) to occupy a complete word (8 bytes), leading to (7 + @@ -262,7 +262,7 @@ Also, hovering over a reference to a field with a struct tag now also display the tag: -<img title="hover shows field tag" src="../features/hover-field-tag.png"> +<img title="hover shows field tag" src="../assets/hover-field-tag.png"> ### Hover and "Go to Definition" work on symbols in doc comments @@ -273,7 +273,7 @@ like identifiers, so hovering over one will display information about the symbol: -<img title="hover shows field tag" src="../features/hover-doclink.png"> +<img title="hover shows field tag" src="../assets/hover-doclink.png"> Similarly, "Go to definition" will navigate to its declaration. Thanks to @rogeryk for contributing this feature.