Skip to content

gopls: pass current file build tags via buildFlags - #1381

Merged
visualfc merged 1 commit into
masterfrom
feat/gopls-buildflags-tags
Nov 19, 2026
Merged

visualfc merged 1 commit into
masterfrom
feat/gopls-buildflags-tags

Conversation

@visualfc

Copy link
Copy Markdown
Owner

Summary

  • Parse //go:build and // +build tags from the current Go file and send them to gopls as buildFlags (-tags=...).
  • Update tags when switching editors so files such as //go:build llgo and // +build ignore are included in gopls package metadata.
  • Keep standaloneTags default ignore, and reopen the current document after tag changes or no package metadata for file.

Test plan

  • Open a package file with a custom tag such as //go:build llgo.
  • Confirm gopls log shows buildFlags: -tags=llgo and completion/navigation work.
  • Open a file with // +build ignore and confirm it is recognized the same way.
  • Switch back to an ordinary package file and confirm gopls still works.

Parse //go:build and // +build tags from the current Go file and send
them to gopls as buildFlags so tagged package files get package
metadata, completion, and navigation.
@visualfc
visualfc merged commit 97d4ade into master Nov 19, 2026
12 checks passed
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 this pull request may close these issues.

1 participant