From 6d2d27938985e210d5b5e561df8a48be20343be7 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 30 Nov 2020 22:28:19 +0200 Subject: Working resolve completion imports prototype --- crates/ide/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 5244bdd61..7015a5126 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -80,7 +80,8 @@ pub use crate::{ }, }; pub use completion::{ - CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, + CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, ImportToAdd, + InsertTextFormat, }; pub use ide_db::{ call_info::CallInfo, -- cgit v1.2.3 From 47464e556c160ce705c2e3c84f501ad4e8dbb123 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 1 Dec 2020 22:46:06 +0200 Subject: Properly fill client completion resolve capabilities data --- crates/ide/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 7015a5126..d1a27f3a5 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -80,8 +80,8 @@ pub use crate::{ }, }; pub use completion::{ - CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, ImportToAdd, - InsertTextFormat, + CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, + CompletionScore, ImportToAdd, InsertTextFormat, }; pub use ide_db::{ call_info::CallInfo, -- cgit v1.2.3 From f6d2540df09bc0dcd8a748ec0ed7cb33ac76d9f2 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 3 Dec 2020 11:13:28 +0200 Subject: Simplify import edit calculation --- crates/ide/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index d1a27f3a5..9e38d6506 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -81,7 +81,7 @@ pub use crate::{ }; pub use completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, - CompletionScore, ImportToAdd, InsertTextFormat, + CompletionScore, ImportEdit, InsertTextFormat, }; pub use ide_db::{ call_info::CallInfo, -- cgit v1.2.3 From 74c3bbacc9b352057f2fc7ab69bd13e53022beb0 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 3 Dec 2020 15:58:18 +0200 Subject: Make completion resolve async --- crates/ide/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 9e38d6506..c52e53d27 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -81,7 +81,7 @@ pub use crate::{ }; pub use completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, - CompletionScore, ImportEdit, InsertTextFormat, + CompletionScore, ImportEdit, ImportEditPtr, InsertTextFormat, }; pub use ide_db::{ call_info::CallInfo, -- cgit v1.2.3 From 93bc009a5968c964693299263689b50b2efe9abc Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 4 Dec 2020 10:02:22 +0200 Subject: Remove the state --- crates/ide/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index c52e53d27..9e38d6506 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -81,7 +81,7 @@ pub use crate::{ }; pub use completion::{ CompletionConfig, CompletionItem, CompletionItemKind, CompletionResolveCapability, - CompletionScore, ImportEdit, ImportEditPtr, InsertTextFormat, + CompletionScore, ImportEdit, InsertTextFormat, }; pub use ide_db::{ call_info::CallInfo, -- cgit v1.2.3 From deda74edd89affb3f77d274776d2a672bc11db90 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 4 Dec 2020 16:03:22 +0200 Subject: Use stateless completion resolve --- crates/ide/src/lib.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 9e38d6506..4a274f5ba 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -469,6 +469,28 @@ impl Analysis { self.with_db(|db| completion::completions(db, config, position).map(Into::into)) } + /// Resolves additional completion data at the position given. + pub fn resolve_completion_edits( + &self, + config: &CompletionConfig, + position: FilePosition, + full_import_path: &str, + imported_name: &str, + ) -> Cancelable> { + Ok(self + .with_db(|db| { + completion::resolve_completion_edits( + db, + config, + position, + full_import_path, + imported_name, + ) + })? + .map(|edit| vec![edit]) + .unwrap_or_default()) + } + /// Computes resolved assists with source changes for the given position. pub fn resolved_assists( &self, -- cgit v1.2.3 From 19cfa5802eabddd5747bbdb04c81b50fc9f6e623 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 6 Dec 2020 23:58:15 +0200 Subject: Simplify --- crates/ide/src/lib.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'crates/ide') diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 4a274f5ba..71068cac2 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -487,7 +487,6 @@ impl Analysis { imported_name, ) })? - .map(|edit| vec![edit]) .unwrap_or_default()) } -- cgit v1.2.3