diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-03-29 23:36:05 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-03-29 23:36:05 +0200 |
| commit | 981e04ffdb15be4e6027445d964e347b7c10ede1 (patch) | |
| tree | dd8eab1314a8abc5ea4df58d054ba1f4fd0bb98b /src/server | |
| parent | d0c8a5408e9a3b66889095d76e63e45d2b4e5fa2 (diff) | |
add all the keywords in odin for completion
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/completion.odin | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index b68bc77..f04b79d 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -48,7 +48,6 @@ get_completion_list :: proc(document: ^Document, position: common.Position) -> ( completion_type: Completion_Type = .Identifier; - if position_context.comp_lit != nil && is_lhs_comp_lit(&position_context) { completion_type = .Comp_Lit; } @@ -737,7 +736,6 @@ get_implicit_completion :: proc(ast_context: ^AstContext, position_context: ^Doc append(&items, item); } - list.items = items[:]; return; } @@ -863,7 +861,6 @@ get_identifier_completion :: proc(ast_context: ^AstContext, position_context: ^D } } - for keyword, _ in common.keyword_map { symbol := index.Symbol { @@ -876,6 +873,26 @@ get_identifier_completion :: proc(ast_context: ^AstContext, position_context: ^D } } + language_keywords: []string = { + "align_of","case","defer","enum","import","proc","transmute","when", + "auto_cast","cast","distinct","fallthrough","in","notin","return","type_of", + "bit_field","const","do","for","inline","offset_of","size_of","typeid", + "bit_set","context","dynamic","foreign","opaque","struct","union", + "break","continue","else","if","map","package","switch","using", + }; + + for keyword, _ in language_keywords { + + symbol := index.Symbol { + name = keyword, + type = .Keyword, + }; + + if score, ok := common.fuzzy_match(matcher, keyword); ok { + append(&combined, CombinedResult {score = score * 1.1, symbol = symbol}); + } + } + sort.sort(combined_sort_interface(&combined)); //hard code for now |