Diagnostic spans, full syntax of json output?

Ale, a linting engine for vim, has a long standing bug regarding only the file currently visible in the buffer being linted. A couple of weeks ago I made an attempt at fixing it, but fell short of creating a pull request due to not fully understanding some of the test cases. It seems the ticket has since stalled, as no one else there seems to grasp the details.

As can be seen from the thread or code, the test sends diagnostic spans where the file_name property is set to <none>. Neither the documentation for rustc nor cargo seem to mention this ever happening, but another issue suggests clippy might put all kinds of stuff within <…>.

Will these json messages ever have values in file_name not being filenames? Is that documented anywhere, or do I need to dive into the source code of the toolchain to discover how it works? Is this perhaps a question crossing over the border of being suitable on irlo rather than urlo?

Related: file_name used to be <MACRONAME macros> for macros, but no longer is. It's still the case that the file_name may not exist. That's as far as I got; not sure about Clippy.

Thank you @quinedot! That linked ticket sure clarified a hard-to-find fact. This information should be enough for me to manage fixing the linter bug.

For completeness, it also seems rustc actually does set filename: <none> when operating on stdin.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.