Skip to content

Commit

Permalink
Added 'address' to list of primitive types
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc committed Jul 26, 2024
1 parent 7a44ade commit 3c4f1a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions external-crates/move/crates/move-analyzer/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn completion_item(label: &str, kind: CompletionItemKind) -> CompletionItem {
/// all specification language keywords, but in the future it should be modified to only do so
/// within a spec block.
fn keywords() -> Vec<CompletionItem> {
KEYWORDS
let mut keywords = KEYWORDS
.iter()
.chain(CONTEXTUAL_KEYWORDS.iter())
.chain(PRIMITIVE_TYPES.iter())
Expand All @@ -89,15 +89,19 @@ fn keywords() -> Vec<CompletionItem> {
};
completion_item(label, kind)
})
.collect()
.collect::<Vec<_>>();
keywords.extend(primitive_types());
keywords
}

/// Return a list of completion items of Move's primitive types
fn primitive_types() -> Vec<CompletionItem> {
PRIMITIVE_TYPES
let mut primitive_types = PRIMITIVE_TYPES
.iter()
.map(|label| completion_item(label, CompletionItemKind::KEYWORD))
.collect()
.collect::<Vec<_>>();
primitive_types.push(completion_item("address", CompletionItemKind::KEYWORD));
primitive_types
}

/// Return a list of completion items corresponding to each one of Move's builtin functions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ Keyword 'u128'
Keyword 'u256'
Keyword 'bool'
Keyword 'vector'
Keyword 'address'

-- test 18 -------------------
use line: 33, use_col: 37
Expand All @@ -505,6 +506,7 @@ Keyword 'u128'
Keyword 'u256'
Keyword 'bool'
Keyword 'vector'
Keyword 'address'

-- test 20 -------------------
use line: 38, use_col: 9
Expand Down Expand Up @@ -599,6 +601,7 @@ Keyword 'u128'
Keyword 'u256'
Keyword 'bool'
Keyword 'vector'
Keyword 'address'
TypeParameter 'SOME_TYPE'

-- test 24 -------------------
Expand Down

0 comments on commit 3c4f1a4

Please sign in to comment.