golang/go

x/tools/gopls: support Go assembly files

Open

#71,754 opened on 2025年2月14日

GitHub で見る
 (14 comments) (8 reactions) (0 assignees)Go (19,008 forks)batch import
FeatureRequestToolsgoplshelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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

コントリビューターガイド