Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scala:annotate imports puts comments in a strange/unexpected place. #57

Open
pcj opened this issue Dec 8, 2022 · 2 comments
Open

scala:annotate imports puts comments in a strange/unexpected place. #57

pcj opened this issue Dec 8, 2022 · 2 comments

Comments

@pcj
Copy link
Member

pcj commented Dec 8, 2022

A user complained about this.

Rather than annotating the RHS of the srcs attribute, annotate the rule (or something else).

Depends on bazel-contrib/bazel-gazelle#1390.

@pcj
Copy link
Member Author

pcj commented Dec 9, 2022

Snippet for existing_scala_rule.go:

assign := r.AttrAssignExpr("srcs")
if assign != nil {
	annotateImports(imports, &assign.Comments, sc.shouldAnnotateImports(), sc.shouldAnnotateUnresolvedDeps())
}

@pcj
Copy link
Member Author

pcj commented Dec 9, 2022

Consider adding a marker line in case comments already exist:

	comments.Before = append(comments.Before, build.Comment{Token: "# ≡[scala imports]≡"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant