Skip to content

Commit

Permalink
[move-ide] Added smart auto-completion for colon-colon (#18778)
Browse files Browse the repository at this point in the history
## Description 

Currently, this PR implements most of functionality for `::`
auto-completion when the cursor is on one of the identifiers in the name
access chains.

There are some missing parts here, arguably better split to separate
PRs:
- handling of access chains in attributes
- handling of access chainss in `use` statements


Also, this PR actually removes `:` completion (auto-completion start
when typing the first character after `:`) which is consistent with what
rust-analyzer does. While we can implement auto-completion right after
`:`, the question is whether we should

## Test plan 

All new and old tests must pass
  • Loading branch information
awelc authored Jul 31, 2024
1 parent b7b2a76 commit 0148d85
Show file tree
Hide file tree
Showing 14 changed files with 1,870 additions and 110 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions external-crates/move/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions external-crates/move/crates/move-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ move-compiler.workspace = true
move-ir-types.workspace = true
move-package.workspace = true
move-symbol-pool.workspace = true
once_cell.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "/*", "close": "*/", "notIn": ["string"] }
],
"brackets": [
"brackets":
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"],
["(", ")"]
],
"comments": {
"lineComment": "//",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct CompilerInfo {
pub macro_info: BTreeMap<Loc, CI::MacroCallInfo>,
pub expanded_lambdas: BTreeSet<Loc>,
pub dot_autocomplete_info: BTreeMap<FileHash, BTreeMap<Loc, CI::DotAutocompleteInfo>>,
pub path_autocomplete_info: BTreeMap<Loc, CI::AliasAutocompleteInfo>,
/// Locations of binders in enum variants that are expanded from an ellipsis (and should
/// not be displayed in any way by the IDE)
pub ellipsis_binders: BTreeSet<Loc>,
Expand Down Expand Up @@ -61,8 +62,8 @@ impl CompilerInfo {
CI::IDEAnnotation::EllipsisMatchEntries(_) => {
self.ellipsis_binders.insert(loc);
}
CI::IDEAnnotation::PathAutocompleteInfo(_) => {
// TODO: Integrate this into the provided compiler information.
CI::IDEAnnotation::PathAutocompleteInfo(info) => {
self.path_autocomplete_info.insert(loc, *info);
}
}
}
Expand Down
Loading

0 comments on commit 0148d85

Please sign in to comment.