golang/go

x/tools/gopls: support Go assembly files

Open

#71.754 aperta il 14 feb 2025

Vedi su GitHub
 (14 commenti) (8 reazioni) (0 assegnatari)Go (19.008 fork)batch import
FeatureRequestToolsgoplshelp wanted

Metriche repository

Star
 (133.883 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Gopls already supports navigating from Go source to assembly files (use "Go to definition" on a func declaration with no body), but it wouldn't be hard for it to support navigation within assembly files, and from assembly files to Go files. The necessary parts are:

  • a new file.Kind for Asm (see https://go.dev/cl/649461 for sketch) and go.s LanguageID.
  • a basic parser for assembly files that can extract symbol names and control labels reliably.
  • recording of parsed assembly files in cache.Package, analogous to CompiledGoFiles.
  • augmentation of the xrefs index to include cross-package references from assembly files.
  • new implementations of the Definitions and References queries for file.Asm.
  • bonus: an implementation of Hover for assembly could provide all kinds of helpful information to make reading easier.
  • bonus: DocumentHighlight could show, for a given register, its def/use chains by making them temporarily bold.
  • go.s languageID support in eglot, vscode-go, neovim.

This is obviously not a high priority, but it's a fun little project.

@golang/compiler @golang/runtime

Guida contributor