diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-31 01:05:54 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-31 01:05:54 +0100 |
| commit | e587db0c06c0972a67867282eb9f16448101f34b (patch) | |
| tree | bc2e50e55b423cc9a0757b734ae7ce902e8b95a7 /src/server | |
| parent | af15c040ce045df81567402cc4ce80412dd36b8f (diff) | |
Improve distinct type info
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/check.odin | 5 | ||||
| -rw-r--r-- | src/server/completion.odin | 23 | ||||
| -rw-r--r-- | src/server/hover.odin | 12 | ||||
| -rw-r--r-- | src/server/signature.odin | 12 |
4 files changed, 29 insertions, 23 deletions
diff --git a/src/server/check.odin b/src/server/check.odin index cdcabde..574227e 100644 --- a/src/server/check.odin +++ b/src/server/check.odin @@ -19,6 +19,11 @@ import "core:text/scanner" import "shared:common" when ODIN_OS == "windows" { + + is_package :: proc(file: string, pkg: string) { + + } + check :: proc(uri: common.Uri, writer: ^Writer, config: ^common.Config) { data := make([]byte, mem.kilobytes(10), context.temp_allocator); diff --git a/src/server/completion.odin b/src/server/completion.odin index 789d60e..38b3c34 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -448,8 +448,8 @@ get_selector_completion :: proc(ast_context: ^analysis.AstContext, position_cont symbol := search.symbol; resolve_unresolved_symbol(ast_context, &symbol); - build_symbol_return(&symbol); - build_symbol_signature(&symbol); + build_procedure_symbol_return(&symbol); + build_procedure_symbol_signature(&symbol); item := CompletionItem { label = symbol.name, @@ -872,8 +872,8 @@ get_identifier_completion :: proc(ast_context: ^analysis.AstContext, position_co for r in results { r := r; resolve_unresolved_symbol(ast_context, &r.symbol); - build_symbol_return(&r.symbol); - build_symbol_signature(&r.symbol); + build_procedure_symbol_return(&r.symbol); + build_procedure_symbol_signature(&r.symbol); if r.symbol.uri != ast_context.uri { append(&combined, CombinedResult {score = r.score, symbol = r.symbol}); } @@ -901,12 +901,12 @@ get_identifier_completion :: proc(ast_context: ^analysis.AstContext, position_co ident := index.new_type(ast.Ident, v.expr.pos, v.expr.end, context.temp_allocator); ident.name = k; - if symbol, ok := resolve_type_identifier(ast_context, ident^); ok { - symbol.name = ident.name; + if symbol, ok := resolve_type_identifier(ast_context, ident^); ok { symbol.signature = get_signature(ast_context, ident^, symbol); + symbol.name = ident.name; - build_symbol_return(&symbol); - build_symbol_signature(&symbol); + build_procedure_symbol_return(&symbol); + build_procedure_symbol_signature(&symbol); if score, ok := common.fuzzy_match(matcher, symbol.name); ok == 1 { append(&combined, CombinedResult {score = score * 1.1, symbol = symbol, variable = ident}); @@ -927,11 +927,12 @@ get_identifier_completion :: proc(ast_context: ^analysis.AstContext, position_co ident.name = k; if symbol, ok := resolve_type_identifier(ast_context, ident^); ok { - symbol.name = ident.name; + symbol.signature = get_signature(ast_context, ident^, symbol); + symbol.name = ident.name; - build_symbol_return(&symbol); - build_symbol_signature(&symbol); + build_procedure_symbol_return(&symbol); + build_procedure_symbol_signature(&symbol); if score, ok := common.fuzzy_match(matcher, symbol.name); ok == 1 { append(&combined, CombinedResult {score = score * 1.1, symbol = symbol, variable = ident}); diff --git a/src/server/hover.odin b/src/server/hover.odin index 443a528..e3e08fa 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -34,8 +34,8 @@ write_hover_content :: proc(ast_context: ^analysis.AstContext, symbol: index.Sym } } - build_symbol_return(&symbol); - build_symbol_signature(&symbol); + build_procedure_symbol_return(&symbol); + build_procedure_symbol_signature(&symbol); cat := concatenate_symbols_information(ast_context, symbol, false); @@ -95,9 +95,9 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit if ident.name == base.name { - if resolved, ok := resolve_type_identifier(&ast_context, ident); ok { - resolved.name = ident.name; + if resolved, ok := resolve_type_identifier(&ast_context, ident); ok { resolved.signature = get_signature(&ast_context, ident, resolved); + resolved.name = ident.name; if is_variable, ok := ast_context.variables[ident.name]; ok && is_variable { resolved.pkg = ast_context.document_package; @@ -162,9 +162,9 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit hover.range = common.get_token_range(position_context.identifier^, document.ast.src); - if resolved, ok := resolve_type_identifier(&ast_context, ident); ok { - resolved.name = ident.name; + if resolved, ok := resolve_type_identifier(&ast_context, ident); ok { resolved.signature = get_signature(&ast_context, ident, resolved); + resolved.name = ident.name; if is_variable, ok := ast_context.variables[ident.name]; ok && is_variable { resolved.pkg = ast_context.document_package; diff --git a/src/server/signature.odin b/src/server/signature.odin index f634327..1e89dc1 100644 --- a/src/server/signature.odin +++ b/src/server/signature.odin @@ -52,7 +52,7 @@ ParameterInformation :: struct { /* Lazily build the signature and returns from ast.Nodes */ -build_symbol_signature :: proc(symbol: ^index.Symbol) { +build_procedure_symbol_signature :: proc(symbol: ^index.Symbol) { if value, ok := symbol.value.(index.SymbolProcedureValue); ok { builder := strings.make_builder(context.temp_allocator); @@ -69,7 +69,7 @@ build_symbol_signature :: proc(symbol: ^index.Symbol) { } } -build_symbol_return :: proc(symbol: ^index.Symbol) { +build_procedure_symbol_return :: proc(symbol: ^index.Symbol) { if value, ok := symbol.value.(index.SymbolProcedureValue); ok { builder := strings.make_builder(context.temp_allocator); @@ -174,8 +174,8 @@ get_signature_information :: proc(document: ^common.Document, position: common.P parameters[i].label = common.node_to_string(arg); } - build_symbol_signature(&call); - build_symbol_return(&call); + build_procedure_symbol_signature(&call); + build_procedure_symbol_return(&call); info := SignatureInformation { label = concatenate_symbols_information(&ast_context, call, false), @@ -205,8 +205,8 @@ get_signature_information :: proc(document: ^common.Document, position: common.P parameters[i].activeParameter = i; } - build_symbol_signature(&symbol); - build_symbol_return(&symbol); + build_procedure_symbol_signature(&symbol); + build_procedure_symbol_return(&symbol); info := SignatureInformation { label = concatenate_symbols_information(&ast_context, symbol, false), |