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

flycheck 0: File with cargo diagnostic not found in VFS: file not found: clippy.toml #15753

Closed
WilliamVenner opened this issue Oct 13, 2023 · 5 comments · Fixed by #15880
Closed
Labels
C-bug Category: bug

Comments

@WilliamVenner
Copy link

WilliamVenner commented Oct 13, 2023

[ERROR rust_analyzer::main_loop] flycheck 0: File with cargo diagnostic not found in VFS: file not found: d:\beam-pls\clippy.toml

VSCode about

Version: 1.83.0 (user setup)
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:12:16.321Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621

rust-analyzer version: rust-analyzer version: 0.3.1689-standalone (b1f89a8 2023-10-06)

rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)

relevant settings:

clippy.toml

new_without_default = false

settings.json (project dir)

{
	"editor.formatOnSave": true,
	"rust-analyzer.check.allTargets": false,
	"rust-analyzer.check.extraArgs": [
		"--all"
	],
	"rust-analyzer.showUnlinkedFileNotification": false,
	"rust-analyzer.check.command": "clippy"
}

settings.json (user preferences)

{
    "rust-analyzer.showUnlinkedFileNotification": false,
    "rust-analyzer.checkOnSave.command": "clippy",
    "rust-analyzer.trace.server": "messages",
    "rust-analyzer.checkOnSave.allTargets": false
}
@WilliamVenner WilliamVenner added the C-bug Category: bug label Oct 13, 2023
@WilliamVenner
Copy link
Author

This is happening on my MacBook as well

@lnicola lnicola self-assigned this Oct 24, 2023
@WilliamVenner
Copy link
Author

Can be reproduced by creating a new cargo project, adding a clippy.toml with some contents, and setting

{
    "rust-analyzer.checkOnSave.command": "clippy"
}

@lnicola
Copy link
Member

lnicola commented Oct 27, 2023

So you probably know this already, but Clippy does not accept new_without_default as a valid lint in the configuration file:

error: error reading Clippy's configuration file: unknown field `new_without_default`, expected one of
           absolute-paths-allowed-crates        arithmetic-side-effects-allowed           doc-valid-idents                         max-struct-bools                            too-large-for-stack
           absolute-paths-max-segments          arithmetic-side-effects-allowed-binary    enable-raw-pointer-heuristic-for-send    max-suggested-slice-pattern-length          too-many-arguments-threshold
           accept-comment-above-attributes      arithmetic-side-effects-allowed-unary     enforce-iter-loop-reborrow               max-trait-bounds                            too-many-lines-threshold
           accept-comment-above-statement       array-size-threshold                      enforced-import-renames                  min-ident-chars-threshold                   trivial-copy-size-limit
           allow-dbg-in-tests                   avoid-breaking-exported-api               enum-variant-name-threshold              missing-docs-in-crate-items                 type-complexity-threshold
           allow-expect-in-tests                await-holding-invalid-types               enum-variant-size-threshold              msrv                                        unnecessary-box-size
           allow-mixed-uninlined-format-args    blacklisted-names                         excessive-nesting-threshold              pass-by-value-size-limit                    unreadable-literal-lint-fractions
           allow-one-hash-in-raw-strings        cargo-ignore-publish                      future-size-threshold                    semicolon-inside-block-ignore-singleline    upper-case-acronyms-aggressive
           allow-print-in-tests                 cognitive-complexity-threshold            ignore-interior-mutability               semicolon-outside-block-ignore-multiline    vec-box-size-threshold
           allow-private-module-inception       cyclomatic-complexity-threshold           large-error-threshold                    single-char-binding-names-threshold         verbose-bit-mask-threshold
           allow-unwrap-in-tests                disallowed-macros                         literal-representation-threshold         stack-size-threshold                        warn-on-all-wildcard-imports
           allowed-dotfiles                     disallowed-methods                        matches-for-let-else                     standard-macro-braces                       
           allowed-idents-below-min-chars       disallowed-names                          max-fn-params-bools                      suppress-restriction-lint-in-const          
           allowed-scripts                      disallowed-types                          max-include-file-size                    third-party                                 

According to the docs, only the ones in https://rust-lang.github.io/rust-clippy/master/index.html#/Configuration are supported.

So we should fix this on our side, of course, but there's no reason why you should be seeing it in a real project.

@lnicola
Copy link
Member

lnicola commented Oct 27, 2023

Implementation note: we can fix this for Cargo projects by adding toml to

dirs.extensions.push("rs".into());
(or multiple clippy.toml vfs::loader::Entry::Files entries below), but it doesn't feel right. A custom check command could report diagnostics anywhere, so we either have to make this configurable, or decide to lazy-load files into the VFS.

CC @Veykril

@lnicola lnicola removed their assignment Oct 27, 2023
@Veykril
Copy link
Member

Veykril commented Nov 10, 2023

We'll have to add the toml files to the VFS soon for the rust-analyzer.toml anyways fwiw. But ye, this is another short coming of our VFS...

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

Successfully merging a pull request may close this issue.

3 participants