zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.45k stars 3.12k forks source link

"//nolint:" comment in Go is reformatted to "// nolint:" #21035

Open nirs opened 8 hours ago

nirs commented 8 hours ago

Check for existing issues

Describe the bug / provide steps to reproduce it

The golangci-lint tool use //nolint: machine readable comments to disable linter checks for line or block. This is useful to avoid false positives for specific file.

When saving, the comment is reformatted to // nolint:. This make things worse since golangci-lint does not treat this as comment, and it adds 2 extra failures for not formatting the nolint comment properly.

This may need to be fixed by golangci-lint by accepting // nolint:, but I think the formatter should be smarter about such comments since this is a very popular tool.

It seems that the formatter need to learn about //nolint: comments by default, or support anything with this pattern: ^//[\w+]:.

This is a pretty bad bug - your options are:

All options are bad.

https://golangci-lint.run/usage/false-positives/#nolint-directive

Environment

Zed: v0.162.3 (Zed) OS: macOS 15.1.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log ``` ```