Content-Length: 230146 | pFad | http://github.com/golang/go/issues/72993

B2 x/tools/gopls: completion: in new file, offer "package main" first if adjacent files declare "package main" · Issue #72993 · golang/go · GitHub
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: completion: in new file, offer "package main" first if adjacent files declare "package main" #72993

Open
xieyuschen opened this issue Mar 21, 2025 · 1 comment
Labels
gopls Issues related to the Go language server, gopls. ToolProposal Issues describing a requested change to a Go tool or command-line program. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@xieyuschen
Copy link
Contributor

xieyuschen commented Mar 21, 2025

In latest gopls(cb292c67c19fd2ca6a9be9ad561c136043fd0472), when I use ctrl+i to trigger suggestion in an empty file a.go, the suggestion main doesn't appear at the top.

➜  go-playground tree .
.
├── a.go
├── go.mod
└── main.go

Image

I expect when there is a go file with package main clause, gopls should put main as the first alternative.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 21, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 21, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/659995 mentions this issue: gopls/completion: use high score for package name main when current package is main

@gabyhelp gabyhelp added the ToolProposal Issues describing a requested change to a Go tool or command-line program. label Mar 21, 2025
@adonovan adonovan changed the title x/tools/gopls: put main package as the first suggestion when there are files with main package x/tools/gopls: completion: in new file, offer "package main" if adjacent files declare "package main" Mar 21, 2025
@adonovan adonovan changed the title x/tools/gopls: completion: in new file, offer "package main" if adjacent files declare "package main" x/tools/gopls: completion: in new file, offer "package main" first if adjacent files declare "package main" Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. ToolProposal Issues describing a requested change to a Go tool or command-line program. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/golang/go/issues/72993

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy