| Summary: | lsp-client: gopls results in constant errors when typing | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Adam Jimerson <vendion> |
| Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | christoph, waqar.17a |
| Priority: | NOR | ||
| Version First Reported In: | 21.12.0 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Hi Adam, Firstly, maybe you are interested in updating the default config for gopls so that users don't have to manually override it? if so, you can find the repo here: http://invent.kde.org/utilities/kate/. The lsp config code is under addons/lsp directory For your issue, perhaps you can paste the full output of the OutputView here? We made some improvements recently to the LSP, and seeing that you are on arch linux, it will probably be very easy to test them out for you and see if the issue is still there. (In reply to Waqar Ahmed from comment #1) > Hi Adam, Hello Waqar, > > Firstly, maybe you are interested in updating the default config for gopls > so that users don't have to manually override it? if so, you can find the > repo here: http://invent.kde.org/utilities/kate/. The lsp config code is > under addons/lsp directory I doubt that the changes I did for gopls would be that helpful to other users as I had to just hardcode the absolute path to the gopls binary. Using the settings in the default config wouldn't launch goplse. If I can find a way to get it to work without hardcoding the path then I'll make a patch. The PHP one maybe worth adding, but there are several supported Language Servers for PHP so I don't know how multiple ones could be defined in the default config and I would need guidance there. Not everyone might want to use intelephense as to fully use it a license must be purchased. > For your issue, perhaps you can paste the full output of the OutputView > here? We made some improvements recently to the LSP, and seeing that you are > on arch linux, it will probably be very easy to test them out for you and > see if the issue is still there. Sure here is the full output from the OutputView 2022/01/05 15:23:26 go env for /home/vendion/projects/ssh-manage (root /home/vendion/projects/ssh-manage) (go version go version go1.17.5 linux/amd64) (valid build configuration = true) (build flags: []) GOROOT=/usr/lib/go GO111MODULE= GONOPROXY= GOPATH=/home/vendion/go GOPRIVATE= GOMOD=/home/vendion/projects/ssh-manage/go.mod GOSUMDB=sum.golang.org GOFLAGS= GOINSECURE= GONOSUMDB= GOCACHE=/home/vendion/.cache/go-build GOMODCACHE=/home/vendion/go/pkg/mod GOPROXY=https://proxy.golang.org,direct 2022/01/05 15:23:26 go/packages.Load snapshot=0 directory=/home/vendion/projects/ssh-manage query=[builtin git.sr.ht/~vendion/ssh-manage/...] packages=11 2022/01/05 15:23:26 falling back to safe trimming due to type errors: [/usr/lib/go/src/runtime/vdso_linux.go:55:38: invalid operation: division by zero /usr/lib/go/src/runtime/vdso_linux.go:56:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true] package="runtime" 2022/01/05 15:23:27 discovered missing identifiers: map[cpuMask:true] package="golang.org/x/sys/unix" 2022/01/05 15:23:27 discovered missing identifiers: map[options:true] package="vendor/golang.org/x/text/unicode/bidi" 2022/01/05 15:23:27 falling back to safe trimming due to type errors: [/usr/lib/go/src/os/user/cgo_lookup_unix.go:200:19: int not declared by package C /usr/lib/go/src/os/user/cgo_lookup_unix.go:203:16: bufferKind(C._SC_GETPW_R_SIZE_MAX) (value of type bufferKind) is not constant /usr/lib/go/src/os/user/cgo_lookup_unix.go:204:16: bufferKind(C._SC_GETGR_R_SIZE_MAX) (value of type bufferKind) is not constant] or still-missing identifiers: map[] package="os/user" 2022/01/05 15:23:27 discovered missing identifiers: map[frameText:true textViewIndex:true] package="github.com/rivo/tview" 2022/01/05 15:23:37 no signature help: cannot find an enclosing function position={32 3} 2022/01/05 15:23:38 no signature help: cannot find an enclosing function position={32 5} 2022/01/05 15:23:49 no signature help: no signature help within a string literal position={32 15} 2022/01/05 15:24:06 background imports cache refresh starting 15:23:25 LSP Client Log Started server go@/home/vendion/projects/ssh-manage: /home/vendion/go/bin/gopls 15:23:26 LSP Server Info Setting up workspace [100%] Finished loading packages. 15:23:26 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:26 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:26 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:27 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:27 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:27 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:27 LSP Server Info go@/home/vendion/projects/ssh-manage 15:23:37 LSP Server Error go@/home/vendion/projects/ssh-manage 15:23:38 LSP Server Error go@/home/vendion/projects/ssh-manage 15:23:49 LSP Server Error go@/home/vendion/projects/ssh-manage 15:24:06 LSP Server Info go@/home/vendion/projects/ssh-manage Note it seems that the "Copy to Clipboard" button is disabled for some reason so I had to highlight -> Open Context Memu -> copy to clipboard instead which looks like it messed up the formatting/didn't copy everything some how. > I doubt that the changes I did for gopls They would with slight changes assuming that a path such as /home/$USER/go/bin is a common path for go to live in, we can provide a config that will automatically search for gopls in this directory. See for example rust's configuration. > The PHP one maybe worth adding, but there are several supported Language Servers That'd be great, however so far no one has been able to come up with a PHP LSP that is good and open source. We have an open issue on the repo regarding PHP LSP, perhaps you can comment there The output unfortunately isn't very helpful. Does the configuration match with what you have in VIM? Perhaps we can find an answer there. Generally the diagnostic errors occur when the server isn't able to locate included files or referenced libraries due to some misconfiguration. (In reply to Waqar Ahmed from comment #3) > They would with slight changes assuming that a path such as > > /home/$USER/go/bin is a common path for go to live in, we can provide a > config that will automatically search for gopls in this directory. See for > example rust's configuration. That sounds good, quick question though, would $HOME be better than /home/$USER I'm trying to think of OSes, like FreeBSD, where the user's home directory is actually /usr/home/$USER (Of course there could be a symlink between /home/$USER and /usr/home/$USER) or something different. > > That'd be great, however so far no one has been able to come up with a PHP > LSP that is good and open source. We have an open issue on the repo > regarding PHP LSP, perhaps you can comment there Yeah I could probably chime in there with my opinion. > > The output unfortunately isn't very helpful. Does the configuration match > with what you have in VIM? Perhaps we can find an answer there. Generally > the diagnostic errors occur when the server isn't able to locate included > files or referenced libraries due to some misconfiguration. I'll have to check how it gets called using [coc-go](https://github.com/josa42/coc-go) to see if it's doing anything differently, but I do know it works in VIM with coc.nvim using the following configurations ``` "languageserver": { "golang": { "command": "gopls", "rootPatterns": ["go.mod"], "filetypes": ["go"] } } ``` - or - ``` "languageserver": { "golang": { "command": "gopls", "args": ["serve", "-debug", "0.0.0.0:8484", "-rpc.trace"], "rootPatterns": ["go.mod"], "filetypes": ["go"] } } ``` Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone! Hmm, I assume this is fixed with https://invent.kde.org/utilities/kate/-/merge_requests/584 ? Not really, but this is more of a server side issue so not a lot we can do other than ignoring the errors |
SUMMARY Editing a Go source code file with Kate configured to use gopls language server results in constant errors to be thrown from gopls that doesn't happen with other text editors such as vim. STEPS TO REPRODUCE 1. Install gopls version v0.7.4 2. Configure Kate to use gopls for Go source code 3. Open a file with Go source code and try to type anything. OBSERVED RESULT If kate is configured so that it will "Switch to output view upon message type: Error" (default behavior), then every couple of keystrokes will result in the output view to pop up, stealing focus from the main textarea with the following error: ``` 2022/01/04 19:26:00 no signature help: cannot find an enclosing function position={32 3} 19:26:00 LSP Server Error go@/home/vendion/projects/ssh-manage ``` Of course, the position value as well as the path will differ. EXPECTED RESULT Gopls shouldn't throw an error with pretty much every keystroke, much like how it works with other text editors configured to use this language server. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.23.5 KDE Frameworks Version: 5.89.0 Qt Version: 5.15.2 Kernel Version: 5.15.12-arch1-1 (64-bit) Graphics Platform: X11 Processors: 8 × Intel® Core™ i7-6820HQ CPU @ 2.70GHz Memory: 31.2 GiB of RAM Graphics Processor: Quadro M1000M/PCIe/SSE2 ADDITIONAL INFORMATION The gopls language server was installed with `go install golang.org/x/tools/gopls@v0.7.4` and I had to override the default LSP config for Go. ``` { "servers": { "go": { "command": [ "/home/vendion/go/bin/gopls" ], "commandDebug": [ "/home/vendion/go/bin/gopls", "-rpc.trace" ], "rootIndicationFileNames": [ "go.mod", "go.sum" ], "url": "golang.org/x/tools/gopls", "highlightingModeRegex": "^Go$" }, "php": { "command": [ "/usr/bin/intelephense", "--stdio" ], "url": "https://github.com/bmewburn/intelephense-docs", "highlightingModeRegex": "^PHP.*$", "rootIndicationFileNames": [ "composer.json", "*.php" ] } } } ```