Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: CL 200604 does not take into account ContentFormat #36031

Closed
myitcv opened this issue Dec 7, 2019 · 2 comments
Closed

x/tools/gopls: CL 200604 does not take into account ContentFormat #36031

myitcv opened this issue Dec 7, 2019 · 2 comments

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented Dec 7, 2019

What version of Go are you using (go version)?

$ go version
go version devel +acf3ff2e8a Tue Dec 3 17:35:06 2019 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20191206204035-259af5ff87bd => /home/myitcv/gostuff/src/golang.org/x/tools
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.1.8-0.20191206204035-259af5ff87bd => /home/myitcv/gostuff/src/golang.org/x/tools/gopls

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build041971431=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Starting gopls with Initialize params as follows:

{
	"Workspace": {
		"configuration": true,
		"didChangeConfiguration": {
			"dynamicRegistration": true
		},
		"didChangeWatchedFiles": {},
		"executeCommand": {},
		"symbol": {
			"symbolKind": {}
		},
		"workspaceEdit": {}
	},
	"textDocument": {
		"codeAction": {
			"codeActionLiteralSupport": {
				"codeActionKind": {
					"valueSet": null
				}
			}
		},
		"codeLens": {},
		"colorProvider": {},
		"completion": {
			"completionItem": {
				"tagSupport": {
					"valueSet": null
				}
			},
			"completionItemKind": {}
		},
		"declaration": {},
		"definition": {},
		"documentHighlight": {},
		"documentLink": {},
		"documentSymbol": {
			"symbolKind": {}
		},
		"foldingRange": {},
		"formatting": {},
		"hover": {
			"contentFormat": [
				"plaintext"
			]
		},
		"implementation": {},
		"onTypeFormatting": {},
		"publishDiagnostics": {
			"tagSupport": {
				"valueSet": null
			}
		},
		"rangeFormatting": {},
		"references": {},
		"rename": {},
		"selectionRange": {},
		"signatureHelp": {
			"signatureInformation": {
				"parameterInformation": {}
			}
		},
		"synchronization": {},
		"typeDefinition": {}
	}
}

Note hover content format is plaintext.

Then trigger a hover, and observe the following response:

{
	"kind": "plaintext",
	"value": "func fmt.Println(a ...interface{}) (n int, err error)\nPrintln formats using the default formats for its operands and writes to standard output.\nSpaces are always added between operands and a newline is appended.\nIt returns the number of bytes written and any write error encountered.\n\n[Println on pkg.go.dev](https://pkg.go.dev/fmt#Println)"
}

Note the markdown formatting around the pkg.go.dev link.

What did you expect to see?

No markdown formatting in the plaintext hover response.

What did you see instead?

Markdown formatting.

It's also unclear to me that we want to unconditionally add this line to every hover documentation response.


cc @stamblerre @heschik

@gopherbot gopherbot added this to the Unreleased milestone Dec 7, 2019
@gopherbot gopherbot added the Tools label Dec 7, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Dec 7, 2019

Thanks for reporting this. I've already mailed CL 210201, which should address this.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Dec 7, 2019

Change https://golang.org/cl/210201 mentions this issue: internal/lsp: improve link in documentation on hover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.