aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-12-15 10:50:53 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-12-15 10:50:53 +0100
commit5fb1dc4465c95939c0fee23d945510c0d50e1ea0 (patch)
tree91b343c2bca75e940f4afc774ad6a8a03875ae1f /src/server
parentf2f8d4a0c68fa9ed713c8a47e8f20b5edd1cc5cb (diff)
improved signatures
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index a24672e..fa342a9 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1767,7 +1767,7 @@ write_hover_content :: proc(ast_context: ^AstContext, symbol: index.Symbol) -> M
return content;
}
-get_signature :: proc(ast_context: ^AstContext, ident: ast.Ident, symbol: index.Symbol) -> string {
+get_signature :: proc(ast_context: ^AstContext, ident: ast.Ident, symbol: index.Symbol, was_variable := false) -> string {
if symbol.type == .Function {
return symbol.signature;
@@ -1778,7 +1778,7 @@ get_signature :: proc(ast_context: ^AstContext, ident: ast.Ident, symbol: index.
if local, ok := ast_context.locals[ident.name]; ok {
if i, ok := local.derived.(ast.Ident); ok {
- return get_signature(ast_context, i, symbol);
+ return get_signature(ast_context, i, symbol, true);
}
else {
@@ -1788,7 +1788,7 @@ get_signature :: proc(ast_context: ^AstContext, ident: ast.Ident, symbol: index.
if global, ok := ast_context.globals[ident.name]; ok {
if i, ok := global.derived.(ast.Ident); ok {
- return get_signature(ast_context, i, symbol);
+ return get_signature(ast_context, i, symbol, true);
}
else {
@@ -1798,6 +1798,17 @@ get_signature :: proc(ast_context: ^AstContext, ident: ast.Ident, symbol: index.
}
+ if !was_variable {
+ #partial switch v in symbol.value {
+ case index.SymbolStructValue:
+ return "struct";
+ case index.SymbolUnionValue:
+ return "union";
+ case index.SymbolEnumValue:
+ return "enum";
+ }
+ }
+
return ident.name;
}
@@ -2159,6 +2170,20 @@ get_completion_list :: proc(document: ^Document, position: common.Position) -> (
}
+ else if position_context.returns != nil && position_context.function != nil {
+
+ //function := position_context.function.derived.(ast.Call_Expr);
+
+
+
+
+
+
+ //if len(position_context.returns.results) == position_context.function.
+
+
+ }
+
list.items = items[:];