| 1 | --- |
| 2 | title: "Gopls: Support for Go *.s assembly files" |
| 3 | --- |
| 4 | |
| 5 | Gopls has rudimentary support for LSP operations in Go assembly files. |
| 6 | |
| 7 | Go assembly files have a `.s` file name extension. LSP clients need to |
| 8 | be configured to recognize `.s` files as Go assembly files, since this |
| 9 | file name extension is also used for assembly files in other |
| 10 | languages. A good heuristic is that if a file named `*.s` belongs to a |
| 11 | directory containing at least one `*.go` file, then the `.s` file is |
| 12 | Go assembly, and its appropriate language server is gopls. |
| 13 | |
| 14 | Only Definition (`textDocument/definition`) requests are currently |
| 15 | supported. For example, a Definition request on the `sigpanic` |
| 16 | symbol in this file in GOROOT/src/runtime/asm.s: |
| 17 | |
| 18 | ```asm |
| 19 | JMP ·sigpanic<ABIInternal>(SB) |
| 20 | ``` |
| 21 | |
| 22 | returns the location of the function declaration in |
| 23 | GOROOT/src/runtime/signal_unix.go: |
| 24 | |
| 25 | ```go |
| 26 | //go:linkname sigpanic |
| 27 | func sigpanic() { |
| 28 | ``` |
| 29 | |
| 30 | See also issue https://go.dev/issue/71754, which tracks the development of LSP |
| 31 | features in Go assembly files. |