fix: Show the path to be created in the unresolved-module fix label

This commit is contained in:
Lukas Wirth 2022-04-04 15:54:29 +02:00
parent 46d7ee68f2
commit 3a847eacc8
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedModule) -> Option<Vec<
.map(|candidate| { .map(|candidate| {
fix( fix(
"create_module", "create_module",
"Create module", &format!("Create module at `{candidate}`"),
FileSystemEdit::CreateFile { FileSystemEdit::CreateFile {
dst: AnchoredPathBuf { dst: AnchoredPathBuf {
anchor: d.decl.file_id.original_file(ctx.sema.db), anchor: d.decl.file_id.original_file(ctx.sema.db),
@ -97,7 +97,7 @@ fn test_unresolved_module_diagnostic() {
"create_module", "create_module",
QuickFix, QuickFix,
), ),
label: "Create module", label: "Create module at `foo.rs`",
group: None, group: None,
target: 0..8, target: 0..8,
source_change: Some( source_change: Some(
@ -123,7 +123,7 @@ fn test_unresolved_module_diagnostic() {
"create_module", "create_module",
QuickFix, QuickFix,
), ),
label: "Create module", label: "Create module at `foo/mod.rs`",
group: None, group: None,
target: 0..8, target: 0..8,
source_change: Some( source_change: Some(

View File

@ -465,7 +465,7 @@ fn main() {}
}, },
json!([ json!([
{ {
"title": "Create module", "title": "Create module at `bar.rs`",
"kind": "quickfix", "kind": "quickfix",
"edit": { "edit": {
"documentChanges": [ "documentChanges": [
@ -477,7 +477,7 @@ fn main() {}
} }
}, },
{ {
"title": "Create module", "title": "Create module at `bar/mod.rs`",
"kind": "quickfix", "kind": "quickfix",
"edit": { "edit": {
"documentChanges": [ "documentChanges": [
@ -549,7 +549,7 @@ fn main() {{}}
}, },
json!([ json!([
{ {
"title": "Create module", "title": "Create module at `bar.rs`",
"kind": "quickfix", "kind": "quickfix",
"edit": { "edit": {
"documentChanges": [ "documentChanges": [
@ -561,7 +561,7 @@ fn main() {{}}
} }
}, },
{ {
"title": "Create module", "title": "Create module at `bar/mod.rs`",
"kind": "quickfix", "kind": "quickfix",
"edit": { "edit": {
"documentChanges": [ "documentChanges": [