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: allow codeAction "Fill struct" from struct identifier #39506

Closed
leitzler opened this issue Jun 10, 2020 · 2 comments
Closed

x/tools/gopls: allow codeAction "Fill struct" from struct identifier #39506

leitzler opened this issue Jun 10, 2020 · 2 comments
Labels
Milestone

Comments

@leitzler
Copy link
Contributor

@leitzler leitzler commented Jun 10, 2020

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

$ go version
go version go1.14.4 darwin/amd64
$ go list -m golang.org/x/tools golang.org/x/tools/gopls
golang.org/x/tools v0.0.0-20200604183345-4d5ea46c79fe
golang.org/x/tools/gopls v0.0.0-20200604183345-4d5ea46c79fe

Does this issue reproduce with the latest release?

n/a, fillstruct wasn't in the latest release

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/leitzler/Library/Caches/go-build"
GOENV="/Users/leitzler/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/leitzler/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j4/l2j99h6d5qd6knjlllql0bb80000gn/T/go-build746857588=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

package main

type foo struct {
	bar bool
}

func main() {
	_ = foo{}
}

I triggered CodeAction refactor.rewrite "Fill struct" with the cursor over f in _ = foo{}.

What did you expect to see?

Structure filled when triggering the code action from the entire struct identifier + brackets (i.e. any of foo{}).

What did you see instead?

Structure filled only when triggered with the cursor at }

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 10, 2020

/cc @joshbaum

@stamblerre stamblerre added this to the gopls/v0.5.0 milestone Jun 10, 2020
leitzler added a commit to govim/govim that referenced this issue Jun 10, 2020
Adds a new command, "GOVIMFillStruct", that populate fields with zero
value in a struct using gopls new code action "Fill struct".

Currently it must be called on an empty struct with the cursor above the
right bracket '}', see golang/go#39506.
leitzler added a commit to govim/govim that referenced this issue Jun 12, 2020
Adds a new command, "GOVIMFillStruct", that populate fields with zero
value in a struct using gopls new code action "Fill struct".

Currently it must be called on an empty struct with the cursor above the
right bracket '}', see golang/go#39506.
leitzler added a commit to govim/govim that referenced this issue Jun 12, 2020
Adds a new command, "GOVIMFillStruct", that populate fields with zero
value in a struct using gopls new code action "Fill struct".

Currently it must be called on an empty struct with the cursor above the
right bracket '}', see golang/go#39506.
@leitzler leitzler closed this Jun 20, 2020
@stamblerre stamblerre modified the milestones: gopls/v0.5.0, gopls/v0.4.2 Jun 23, 2020
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.