aboutsummaryrefslogtreecommitdiff
path: root/src/server/completion.odin
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2023-06-29 18:20:08 +0200
committerDanielGavin <danielgavin5@hotmail.com>2023-06-29 18:20:08 +0200
commitae78fc93465e7604c19af3f6a6339a6667cb8cf1 (patch)
treebb3965d1ad8ce26109f5d8aeed0564671c9a00ff /src/server/completion.odin
parentf2427a91ba14cb1fc730d42fea8d309a13608325 (diff)
Start working on having fake methods.
Diffstat (limited to 'src/server/completion.odin')
-rw-r--r--src/server/completion.odin49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 77cc399..572026f 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -162,6 +162,7 @@ get_attribute_completion :: proc(
list: ^CompletionList,
) {
+
}
get_directive_completion :: proc(
@@ -333,6 +334,8 @@ get_selector_completion :: proc(
}
}
+ //append_method_completion(ast_context, selector, &items)
+
#partial switch v in selector.value {
case SymbolFixedArrayValue:
list.isIncomplete = true
@@ -1608,6 +1611,52 @@ get_range_from_selection_start_to_dot :: proc(
return {}, false
}
+append_method_completion :: proc(
+ ast_context: ^AstContext,
+ symbol: Symbol,
+ items: ^[dynamic]CompletionItem,
+) {
+ if symbol.type != .Variable {
+ return
+ }
+
+ for k, v in indexer.index.collection.packages {
+ method := Method {
+ name = symbol.name,
+ pkg = symbol.pkg,
+ }
+ if symbols, ok := &v.methods[method]; ok {
+ for symbol in symbols {
+
+ resolve_unresolved_symbol(ast_context, &symbol)
+ build_procedure_symbol_signature(&symbol)
+
+ item := CompletionItem {
+ label = symbol.name,
+ kind = cast(CompletionItemKind)symbol.type,
+ detail = concatenate_symbol_information(
+ ast_context,
+ symbol,
+ true,
+ ),
+ documentation = symbol.doc,
+ }
+
+ if symbol.type == .Function && common.config.enable_snippets {
+ item.insertText = fmt.tprintf("%v($0)", item.label)
+ item.insertTextFormat = .Snippet
+ item.command = Command {
+ command = "editor.action.triggerParameterHints",
+ }
+ item.deprecated = .Deprecated in symbol.flags
+ }
+
+ append(items, item)
+ }
+ }
+ }
+}
+
append_magic_map_completion :: proc(
position_context: ^DocumentPositionContext,
symbol: Symbol,