aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/diagnostics.rs13
-rw-r--r--crates/ide/src/lib.rs22
2 files changed, 24 insertions, 11 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 3ad30f0c9..b2714cb69 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -895,4 +895,17 @@ impl TestStruct {
895"#, 895"#,
896 ); 896 );
897 } 897 }
898
899 #[test]
900 fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() {
901 let input = r#"fn FOO<|>() {}"#;
902 let expected = r#"fn foo() {}"#;
903
904 let (analysis, file_position) = fixture::position(input);
905 let diagnostics =
906 analysis.diagnostics(&DiagnosticsConfig::default(), file_position.file_id).unwrap();
907 assert_eq!(diagnostics.len(), 1);
908
909 check_fixes(input, expected);
910 }
898} 911}
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 52c7f9775..a75cc85b6 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -490,8 +490,18 @@ impl Analysis {
490 .unwrap_or_default()) 490 .unwrap_or_default())
491 } 491 }
492 492
493 /// Computes assists (aka code actions aka intentions) for the given
494 /// position. Computes enough info to show the lightbulb list in the editor,
495 /// but doesn't compute actual edits, to improve performance.
496 ///
497 /// When the user clicks on the assist, call `resolve_assists` to get the
498 /// edit.
499 pub fn assists(&self, config: &AssistConfig, frange: FileRange) -> Cancelable<Vec<Assist>> {
500 self.with_db(|db| Assist::unresolved(db, config, frange))
501 }
502
493 /// Computes resolved assists with source changes for the given position. 503 /// Computes resolved assists with source changes for the given position.
494 pub fn resolved_assists( 504 pub fn resolve_assists(
495 &self, 505 &self,
496 config: &AssistConfig, 506 config: &AssistConfig,
497 frange: FileRange, 507 frange: FileRange,
@@ -499,16 +509,6 @@ impl Analysis {
499 self.with_db(|db| assists::Assist::resolved(db, config, frange)) 509 self.with_db(|db| assists::Assist::resolved(db, config, frange))
500 } 510 }
501 511
502 /// Computes unresolved assists (aka code actions aka intentions) for the given
503 /// position.
504 pub fn unresolved_assists(
505 &self,
506 config: &AssistConfig,
507 frange: FileRange,
508 ) -> Cancelable<Vec<Assist>> {
509 self.with_db(|db| Assist::unresolved(db, config, frange))
510 }
511
512 /// Computes the set of diagnostics for the given file. 512 /// Computes the set of diagnostics for the given file.
513 pub fn diagnostics( 513 pub fn diagnostics(
514 &self, 514 &self,