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: add go:embed support #50262

Open
hamidfzm opened this issue Dec 10, 2021 · 4 comments
Open

x/tools/gopls: add go:embed support #50262

hamidfzm opened this issue Dec 10, 2021 · 4 comments
Assignees
Labels
FeatureRequest gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hamidfzm
Copy link

hamidfzm commented Dec 10, 2021

Is your feature request related to a problem? Please describe.
Go embed feature introduced in version 1.16. Currently, go-vscode treats text like //go:embed app as a simple comment.

Describe the solution you'd like
Provide text highlighting or navigation by CTRL+Clicking on these comments

Describe alternatives you've considered
Goland provides this feature in its recent versions:
Screenshot from 2021-12-10 18-21-42

Additional context
VS code view
Screenshot from 2021-12-10 18-25-51

It would be really nice if we have this feature in my favorite code editor.

@findleyr
Copy link
Contributor

findleyr commented Dec 19, 2021

This could be implemented with a code action+associated command that invokes window/showDocument. It could also be implemented with jump-to-definition+hover. I am not sure which is best, but this seems to belong in the gopls issue tracker.

@findleyr findleyr transferred this issue from golang/vscode-go Dec 19, 2021
@findleyr findleyr changed the title Add go:embed support x/tools/gopls: add go:embed support Dec 19, 2021
@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 Dec 19, 2021
@gopherbot gopherbot added this to the Unreleased milestone Dec 19, 2021
@findleyr findleyr added FeatureRequest help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 19, 2021
@findleyr findleyr modified the milestones: Unreleased, gopls/unplanned Dec 19, 2021
@hyangah
Copy link
Contributor

hyangah commented Jan 26, 2022

For individual files, code action associated with window/showDocument or textDocument/documentLink would work. We still need a solution for handling folder type resources. For VSCode, I filed an issue microsoft/vscode#141564.

@ansaba ansaba self-assigned this Apr 11, 2022
@ansaba
Copy link

ansaba commented May 11, 2022

List of improvements

  • checks for the "embed" import
  • Report it as semantic for highlighting
  • The directive must immediately precede a line containing the declaration of a single variable. Only blank lines and ‘//’ line comments are permitted between the directive and the declaration.

@findleyr
Copy link
Contributor

findleyr commented May 18, 2022

We should also include a quick-fix to add the missing "embed" import.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 28, 2022
New Features

New analyzer for //go:embed comments

Gopls now includes an analyzer for go:embed comment directives. At
the moment, this analyzer checks that the "embed" import is present,
but more analyses are planned for the future. See golang/go#50262
for more information.

Improved hover for imports

Hovering over an imported path now gives you the full package doc.

Final support for Go 1.13

Per our support window, gopls v0.8.4 will be the final gopls release
to support being built with Go 1.13. See golang/go#52982 for details.

Bugfixes and Performance improvements

    Faster symbol indexing. Gopls builds a symbol index the first
    time symbol search is invoked. That indexing should be 3-4x
    faster with this release.

    Improved metadata invalidation (AKA fewer restarts). v0.8.4
    fixes a couple of bugs that lead to gopls getting confused
    about packages and needing to be restarted. We're aware of more
    bugs of this nature, but are working on eliminating the need
    to ever restart gopls.
@findleyr findleyr added the gopls/analysis Issues related to running analysis in gopls label Jul 20, 2022
@findleyr findleyr modified the milestones: gopls/unplanned, gopls/later Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants