tree-sitter / tree-sitter-go

Go grammar for tree-sitter
MIT License
317 stars 63 forks source link

Differentiate symbols mentioned as the first phrase of a comment string #108

Closed weakphish closed 1 year ago

weakphish commented 1 year ago

Copied from https://github.com/helix-editor/helix/issues/5909

In Go, the standard idiom is to begin docstrings with the name of the symbol being described, like so:

// foo performs an action
func foo() {
    fmt.Println("bar")
}

// Bar is a struct
type Bar struct {
    baz int 
}

I propose that, similar to Goland from Jetbrains, the first term of a Go docstring be differentiated.

amaanq commented 1 year ago

Can be done with queries

kackerx commented 1 year ago

There is also the interface of go, ts can't recognize it, how to use the query, ,