Closed
Description
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:
Additional context
VS code view
It would be really nice if we have this feature in my favorite code editor.
Metadata
Metadata
Assignees
Labels
Issues asking for a new feature that does not need a proposal.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.This label describes issues relating to any tools in the x/tools repository.Issues related to the Go language server, gopls.Issues related to running analysis in gopls
Type
Projects
Relationships
Development
No branches or pull requests
Activity
findleyr commentedon 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.
[-]Add go:embed support[/-][+]x/tools/gopls: add go:embed support[/+]hyangah commentedon Jan 26, 2022
For individual files, code action associated with
window/showDocument
ortextDocument/documentLink
would work. We still need a solution for handling folder type resources. For VSCode, I filed an issue microsoft/vscode#141564.ansaba commentedon May 11, 2022
List of improvements
Report it as semantic for highlightingEDIT (rfindley): cross out semantic highlighting, as I think we should punt on that for now
findleyr commentedon May 18, 2022
We should also include a quick-fix to add the missing "embed" import.
23 remaining items
vikblom commentedon Jul 31, 2023
Hi @findleyr, is there a path forward with semantic highlighting here, given that the vscode ticket was closed by triage?
I tried out a naive
textDocument/documentLink
solution passingfile://
URIs. Emacs could handle both files and directories. VSCode only accepted files. Does it makes sense to use that as a opt-in or base case (only files) feature?You mentioned code action+associated command and jump-to-definition+hover above, which seems doable. However if VSCode requires specific (or new) mechanisms to handle directories, this feature might spread to codebases (
vscode
orvscode-go
) I'm not familiar withfindleyr commentedon Sep 8, 2023
Hi @vikblom, very sorry for the slow response on this.
Let's not worry about semantic tokens for now, I think that's a low priority. We can treat highlighting
//go:
directives as a separate project.We discussed this in our triage meeting, and I think jump-to-definition+hover is the best way to implement this feature, as it will be supported by the greatest number of LSP clients. For directories, perhaps we should just pick an arbitrary file in the directory?
vikblom commentedon Sep 8, 2023
An arbitrary file could be unexpected as a user. But I don't see any alternatives if this is a limitation of LSP clients. I agree it is a good place to start.
I'll try to put something together and post a CL.
findleyr commentedon Sep 8, 2023
Great, thanks for sticking to this!
gopherbot commentedon Sep 21, 2023
Change https://go.dev/cl/530195 mentions this issue:
gopls/internal/lsp: hover over embed directives.
gopls/internal/lsp: hover over embed directives
gopherbot commentedon Sep 29, 2023
Change https://go.dev/cl/531775 mentions this issue:
gopls/internal/lsp: go to definition from embed directive
gopls/internal/lsp: go to definition from embed directive
vikblom commentedon Oct 10, 2023
Hi @findleyr, what do you think is the next step? Would tackling semantic highlighting make sense?
findleyr commentedon Oct 10, 2023
@vikblom if we're going to highlight go:embed, I think we should highlight all go: directives. Is that something you'd be interested in?
If so, I think we should perhaps make that a separate issue, and close this one.
vikblom commentedon Oct 10, 2023
Sure, I'd be glad to take a look directive highlights!
Thanks again for all the help in this issue.
findleyr commentedon Oct 13, 2023
Great! Opened https://go.dev/issue/63538.
Will close this then.