x/tools/gopls semantically tokenize export comments#604
Open
JoeyShapiro wants to merge 1 commit intogolang:masterfrom
Open
x/tools/gopls semantically tokenize export comments#604JoeyShapiro wants to merge 1 commit intogolang:masterfrom
JoeyShapiro wants to merge 1 commit intogolang:masterfrom
Conversation
Contributor
|
This PR (HEAD: 81dbc8f) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/721860. Important tips:
|
Contributor
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/721860. |
Contributor
|
Message from Joey Shapiro: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/721860. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I would like to colorize the export comments in golang a different
color. I have this PR, and it kinda works, as shown below.
main_test.go
//go:build cgo
package main
//export main
func main() {
}
Before
$ ~/go/bin/gopls semtok main_test.go
/⇒2,comment,[]/// /⇒8,namespace,[]/go:build /⇒3,comment,[]/cgo
/⇒7,keyword,[]/package /⇒4,namespace,[]/main
/⇒13,comment,[]///export main
/⇒4,keyword,[]/func /⇒4,function,[definition]/main() {
}
After
$ go run . -- semtok main_test.go
/⇒2,comment,[]/// /⇒8,namespace,[]/go:build /⇒3,comment,[]/cgo
/⇒7,keyword,[]/package /⇒4,namespace,[]/main
/⇒2,comment,[]/// /⇒7,namespace,[]/export /⇒4,function,[]/main
/⇒4,keyword,[]/func /⇒4,function,[definition]/main() {
}
I copied what go directives do, but it still needs some work. I want to write some tests and find a way to only colorize it when the export is directly above a function header.
Before I get any farther, could I get confirmation that a PR like this would be accepted. Or is there a reason this has not been added in.