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

gopls v0.18.0 deprecated hoverKind=Structured #3701

Open
RaphaelPour opened this issue Feb 21, 2025 · 10 comments · May be fixed by #3702
Open

gopls v0.18.0 deprecated hoverKind=Structured #3701

RaphaelPour opened this issue Feb 21, 2025 · 10 comments · May be fixed by #3702

Comments

@RaphaelPour
Copy link

RaphaelPour commented Feb 21, 2025

gopls v0.18.0 just got released and deprecated the hoverKind value Strctured which vim-go uses:

The experimental Structured value for the hoverKind option is no longer supported.

Can someone look into this which value should be used instead? If I understood the original deprecation issue right, FullDocumentation (which is the default) is recommended to use instead.

Observation

  • installed go 1.24.0
  • updated vim-go via vundler :PluginUpdate
  • updated go binaries using :GoUpdateBinaries
  • opened an arbitrary go file
Messages maintainer: The Vim Project
"main.go" 23L, 804B
vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Invalid settings: setting option "hoverKind": this setting is deprecated, use "the experimental hoverKind='structured' setting was removed in gopls/v0.18.0 (https://go.dev/issue/70233)" instead
vim-go: Finished loading packages.
vim-go: Invalid settings: setting option "hoverKind": this setting is deprecated, use "the experimental hoverKind='structured' setting was removed in gopls/v0.18.0 (https://go.dev/issue/70233)" instead
Press ENTER or type command to continue

Looking into the vim-go repo, this deprecated setting is used at least once:

✔vim-go [master ✔] $ ag hoverKind
autoload/go/lsp/message.vim
307:          \ 'hoverKind': 'Structured',
@RaphaelPour RaphaelPour changed the title gopls v0.18.0 deprecated hoverKind=structured gopls v0.18.0 deprecated hoverKind=Structured Feb 21, 2025
@bgarber
Copy link

bgarber commented Feb 21, 2025

I was just about to open exactly this same issue. I locally changed the option to FullDocumentation with no greater side-effect on my environment, but I would like one of the vim-go experts to check on this one to understand the impact of the change. @fatih

@RaphaelPour
Copy link
Author

I was just about to open exactly this same issue. I locally changed the option to FullDocumentation with no greater side-effect on my environment, but I would like one of the vim-go experts to check on this one to understand the impact of the change. @fatih

This doesn't work for me. When I change the hoverKind to FullDocumentation within autoload/go/lsp/message.vim...

let l:config = {
      \ 'buildFlags': [],
      \ 'hoverKind': 'FullDocumentation',
      \ }

... I get a JSON decoder error:

Messages maintainer: The Vim Project
"main.go" 23L, 804B
vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Finished loading packages.
Error detected while processing function 107[13]..109[37]..function 107[13]..109[26]..<SNR>75_info:
line    5:
E491: JSON decode error at 'package cmd^@Copyright © 2020 Raphael Pour <[email protected]>^@^@This program is free software: you can redistribute it and/or modify^@it under the ter
ms of the GNU General Public License as published by^@the Free Software Foundation, either version 3 of the License, or^@(at your option) any later version.^@^@This program is distri
buted in the hope that it will be useful,^@but WITHOUT ANY WARRANTY; without even the implied warranty of^@MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the^@GNU General
Public License for more details.^@^@You should have received a copy of the GNU General Public License^@along with this program. If not, see <http://www.gnu.org/licenses/>.^@'

@PierreKieffer
Copy link

Following @bgarber , I did the same and it fixed the problem on my environment.
The different options available in v0.18.0 are:

HoverKind string

const (
	SingleLine            HoverKind = "SingleLine"
	NoDocumentation       HoverKind = "NoDocumentation"
	SynopsisDocumentation HoverKind = "SynopsisDocumentation"
	FullDocumentation     HoverKind = "FullDocumentation"
)

Source : https://github.com/golang/tools/blob/master/gopls/internal/settings/settings.go#L794

Change : golang/tools@8127761

@findleyr
Copy link

findleyr commented Feb 21, 2025

Hi, removing this setting so hastily was our mistake as gopls maintainers. I'm going to add it back for [email protected], which we will in all likelihood release on Monday.

In order to minimize disruption, I'm going to add it back without a warning in [email protected], so that your users don't get a popup. I would ask, however, that you do remove your usage of it, so that we can add a warning in [email protected], and remove it in [email protected].

Tracked in https://go.dev/issue/71879

Sorry for the breakage.

@bhcleek
Copy link
Collaborator

bhcleek commented Feb 21, 2025

Thank you, @findleyr; I appreciate the fast turnaround. I'll work to refactor vim-go to use FullDocumentation.

@findleyr
Copy link

We've cut a prerelease with the revert:

go install golang.org/x/tools/[email protected]

Could someone verify that this fixes vim-go?
Once verified, we can cut the patch release (Monday earliest).

@matthiashapp
Copy link

in the initial hover were json tags and now it's SingleLine instead of singleLine on the hoverResult struct:
https://go-review.googlesource.com/c/tools/+/635226/6/gopls/internal/golang/hover.go

if i change that for the hover result it's working but the spelling might break other parts of vim-go ? Where it's required lowerCamelCase ?

@findleyr
Copy link

Oof, thank you for testing @matthiashapp, in my haste to fix, I overlooked the struct tags 🤦.

I'll fix.

@findleyr
Copy link

Once more, if you don't mind. It's too late in the day to cut another prerelease, but you can install off the release branch:

go install golang.org/x/tools/[email protected]

Thanks again.

@findleyr
Copy link

findleyr commented Feb 24, 2025

The setting is now reinstated in [email protected]: https://github.com/golang/tools/releases/tag/gopls%2Fv0.18.1

jsageryd added a commit to jsageryd/.config.d that referenced this issue Feb 25, 2025
@bhcleek bhcleek linked a pull request Mar 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants