diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-13 21:23:30 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-13 21:23:30 +0100 |
| commit | f4881fddf7e7c003a709a3ed5fd413270d41d261 (patch) | |
| tree | ab4cf3008856cdebfa032bb833957c607f2735e0 /src/index | |
| parent | c67ba465cbee1c450f75785905ba5d74d03cb3c8 (diff) | |
Improved type completion + add constants type, add deprecrated tag.
Diffstat (limited to 'src/index')
| -rw-r--r-- | src/index/collector.odin | 14 | ||||
| -rw-r--r-- | src/index/symbol.odin | 28 |
2 files changed, 25 insertions, 17 deletions
diff --git a/src/index/collector.odin b/src/index/collector.odin index c9c7848..74c47e1 100644 --- a/src/index/collector.odin +++ b/src/index/collector.odin @@ -347,21 +347,22 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri case ast.Basic_Lit: token = v; symbol.value = collect_generic(collection, col_expr, package_map); - case ast.Ident: - token = v; - symbol.value = collect_generic(collection, col_expr, package_map); if expr.mutable { token_type = .Variable; } else { - token_type = .Unresolved; + token_type = .Constant; } - case: // default + case ast.Ident: + token = v; symbol.value = collect_generic(collection, col_expr, package_map); if expr.mutable { token_type = .Variable; } else { token_type = .Unresolved; } + case: // default + symbol.value = collect_generic(collection, col_expr, package_map); + token_type = .Unresolved; token = expr.expr; } @@ -370,6 +371,9 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri symbol.pkg = get_index_unique_string(collection, directory); symbol.type = token_type; symbol.doc = common.get_doc(expr.docs, collection.allocator); + symbol.is_deprecated = expr.deprecated; + symbol.is_private_file = expr.file_private; + symbol.is_private_package = expr.package_private; when ODIN_OS == "windows" { symbol.uri = get_index_unique_string(collection, strings.to_lower(uri, context.temp_allocator)); diff --git a/src/index/symbol.odin b/src/index/symbol.odin index a429a17..8e13786 100644 --- a/src/index/symbol.odin +++ b/src/index/symbol.odin @@ -103,18 +103,21 @@ SymbolValue :: union { } Symbol :: struct { - range: common.Range, - uri: string, - pkg: string, - name: string, - doc: string, - signature: string, - returns: string, - type: SymbolType, - value: SymbolValue, - references: []common.Location, - pointers: int, - is_distinct: bool, + range: common.Range, + uri: string, + pkg: string, + name: string, + doc: string, + signature: string, + returns: string, + type: SymbolType, + value: SymbolValue, + references: []common.Location, + pointers: int, + is_distinct: bool, + is_deprecated: bool, + is_private_file: bool, + is_private_package: bool, } SymbolType :: enum { @@ -125,6 +128,7 @@ SymbolType :: enum { Enum = 13, Keyword = 14, EnumMember = 20, + Constant = 21, Struct = 22, Unresolved = 9999, } |