aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-03-12 22:07:26 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-03-12 22:07:26 +0100
commit8f3ec02f79ad5061158c7f8dd09e8f2ce2353a16 (patch)
tree69b5d6aa23edcef18137940710b95372104b51f5 /src
parent5a95f96a9a96536e247c64af56f4a756c68b6bb3 (diff)
Fix hover error and change union complete type
Diffstat (limited to 'src')
-rw-r--r--src/index/build.odin1
-rw-r--r--src/index/collector.odin4
-rw-r--r--src/index/symbol.odin2
-rw-r--r--src/server/hover.odin9
4 files changed, 5 insertions, 11 deletions
diff --git a/src/index/build.odin b/src/index/build.odin
index 7226e24..21b48d5 100644
--- a/src/index/build.odin
+++ b/src/index/build.odin
@@ -144,7 +144,6 @@ build_static_index :: proc(allocator := context.allocator, config: ^common.Confi
uri := common.create_uri(fullpath, context.allocator)
- //ERROR hover on uri does not show string
collect_symbols(&symbol_collection, file, uri.uri)
free_all(context.allocator)
diff --git a/src/index/collector.odin b/src/index/collector.odin
index fc8d857..0145035 100644
--- a/src/index/collector.odin
+++ b/src/index/collector.odin
@@ -419,9 +419,8 @@ get_package_mapping :: proc(file: ast.File, config: ^common.Config, directory: s
for imp, index in file.imports {
//collection specified
if i := strings.index(imp.fullpath, ":"); i != -1 {
- //ERROR hover on collection should show string
collection := imp.fullpath[1:i]
- p := imp.fullpath[i + 1:len(imp.fullpath) - 1]
+ p := imp.fullpath[i + 1:len(imp.fullpath) - 1]
dir, ok := config.collections[collection]
@@ -452,7 +451,6 @@ get_package_mapping :: proc(file: ast.File, config: ^common.Config, directory: s
name: string
full := path.join(elems = {directory, imp.fullpath[1:len(imp.fullpath) - 1]}, allocator = context.temp_allocator)
-
full = path.clean(full, context.temp_allocator)
if imp.name.text != "" {
diff --git a/src/index/symbol.odin b/src/index/symbol.odin
index 6358d04..593e4f5 100644
--- a/src/index/symbol.odin
+++ b/src/index/symbol.odin
@@ -133,7 +133,7 @@ SymbolType :: enum {
EnumMember = 20,
Constant = 21,
Struct = 22,
- Union = 9000,
+ Union = 7,
Unresolved = 9999,
}
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 5dd6acf..a5c3b5e 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -80,13 +80,12 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit
if position_context.selector != nil && position_context.identifier != nil {
hover.range = common.get_token_range(position_context.identifier^, ast_context.file.src)
- ast_context.use_locals = true
- ast_context.use_globals = true
+ ast_context.use_locals = true
+ ast_context.use_globals = true
ast_context.current_package = ast_context.document_package
//if the base selector is the client wants to go to.
- if base, ok := position_context.selector.derived.(^ast.Ident); ok && position_context.identifier != nil {
-
+ if base, ok := position_context.selector.derived.(^ast.Ident); ok && position_context.identifier != nil && position_in_node(position_context.selector, position_context.position) {
ident := position_context.identifier.derived.(^ast.Ident)^
if ident.name == base.name {
@@ -115,7 +114,6 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit
field: string
if position_context.field != nil {
-
#partial switch v in position_context.field.derived {
case ^ast.Ident:
field = v.name
@@ -149,7 +147,6 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit
}
}
} else if position_context.identifier != nil {
-
ast_context.use_locals = true
ast_context.use_globals = true
ast_context.current_package = ast_context.document_package