This commit is contained in:
Stanislav 2022-09-09 20:58:06 +03:00
parent 773f9b38e3
commit f7f4792f4f
4 changed files with 14 additions and 17 deletions

View file

@ -118,8 +118,6 @@ pub(crate) fn find_all_refs(
} }
fn filter_import_references(usages: &mut UsageSearchResult) { fn filter_import_references(usages: &mut UsageSearchResult) {
// todo use this https://github.com/rust-lang/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs#L432
for (_file_id, refs) in &mut usages.references { for (_file_id, refs) in &mut usages.references {
refs.retain(|it| match it.name.as_name_ref() { refs.retain(|it| match it.name.as_name_ref() {
Some(name_ref) => { Some(name_ref) => {

View file

@ -219,10 +219,6 @@ config_data! {
files_excludeDirs: Vec<PathBuf> = "[]", files_excludeDirs: Vec<PathBuf> = "[]",
/// Controls file watching implementation. /// Controls file watching implementation.
files_watcher: FilesWatcherDef = "\"client\"", files_watcher: FilesWatcherDef = "\"client\"",
/// Exclude imports from find-all-references.
findAllRefs_excludeImports: bool = "false",
/// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords. /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
highlightRelated_breakPoints_enable: bool = "true", highlightRelated_breakPoints_enable: bool = "true",
/// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`). /// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
@ -362,6 +358,9 @@ config_data! {
/// this is rust-analyzer itself, but we override this in tests). /// this is rust-analyzer itself, but we override this in tests).
procMacro_server: Option<PathBuf> = "null", procMacro_server: Option<PathBuf> = "null",
/// Exclude imports from find-all-references.
references_excludeImports: bool = "false",
/// Command to be executed instead of 'cargo' for runnables. /// Command to be executed instead of 'cargo' for runnables.
runnables_command: Option<String> = "null", runnables_command: Option<String> = "null",
/// Additional arguments to be passed to cargo for runnables such as /// Additional arguments to be passed to cargo for runnables such as
@ -1151,7 +1150,7 @@ impl Config {
} }
pub fn find_all_refs_exclude_imports(&self) -> bool { pub fn find_all_refs_exclude_imports(&self) -> bool {
self.data.findAllRefs_excludeImports self.data.references_excludeImports
} }
pub fn snippet_cap(&self) -> bool { pub fn snippet_cap(&self) -> bool {

View file

@ -262,11 +262,6 @@ also need to add the folders to Code's `files.watcherExclude`.
-- --
Controls file watching implementation. Controls file watching implementation.
-- --
[[rust-analyzer.findAllRefs.excludeImports]]rust-analyzer.findAllRefs.excludeImports (default: `false`)::
+
--
Exclude imports from find-all-references.
--
[[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`):: [[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`)::
+ +
-- --
@ -551,6 +546,11 @@ This config takes a map of crate names with the exported proc-macro names to ign
Internal config, path to proc-macro server executable (typically, Internal config, path to proc-macro server executable (typically,
this is rust-analyzer itself, but we override this in tests). this is rust-analyzer itself, but we override this in tests).
-- --
[[rust-analyzer.references.excludeImports]]rust-analyzer.references.excludeImports (default: `false`)::
+
--
Exclude imports from find-all-references.
--
[[rust-analyzer.runnables.command]]rust-analyzer.runnables.command (default: `null`):: [[rust-analyzer.runnables.command]]rust-analyzer.runnables.command (default: `null`)::
+ +
-- --

View file

@ -706,11 +706,6 @@
"Use server-side file watching" "Use server-side file watching"
] ]
}, },
"rust-analyzer.findAllRefs.excludeImports": {
"markdownDescription": "Exclude imports from find-all-references.",
"default": false,
"type": "boolean"
},
"rust-analyzer.highlightRelated.breakPoints.enable": { "rust-analyzer.highlightRelated.breakPoints.enable": {
"markdownDescription": "Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.", "markdownDescription": "Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.",
"default": true, "default": true,
@ -1041,6 +1036,11 @@
"string" "string"
] ]
}, },
"rust-analyzer.references.excludeImports": {
"markdownDescription": "Exclude imports from find-all-references.",
"default": false,
"type": "boolean"
},
"rust-analyzer.runnables.command": { "rust-analyzer.runnables.command": {
"markdownDescription": "Command to be executed instead of 'cargo' for runnables.", "markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
"default": null, "default": null,