aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2021-03-14 15:30:59 +0100
committerDanielGavin <danielgavin5@hotmail.com>2021-03-14 15:30:59 +0100
commit41fe85dc3a369c17016afa1aee717f442142c3bf (patch)
treec6e0d608280447155b61f06f1cf1119108422fb0 /src/server
parenta8cfb48af3586903ec07dc518932b317c248012c (diff)
added bitset completion for all binary operators
Diffstat (limited to 'src/server')
-rw-r--r--src/server/completion.odin40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 238e7ca..762c36c 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -420,7 +420,7 @@ get_implicit_completion :: proc (ast_context: ^AstContext, position_context: ^Do
append(&items, item);
}
}
- } else if position_context.comp_lit != nil && position_context.binary != nil && (position_context.binary.op.text == "&") {
+ } else if position_context.comp_lit != nil && position_context.binary != nil && is_bitset_binary_operator(position_context.binary.op.text) {
//bitsets
context_node: ^ast.Expr;
bitset_node: ^ast.Expr;
@@ -814,3 +814,41 @@ get_type_switch_Completion :: proc (ast_context: ^AstContext, position_context:
list.items = items[:];
}
+
+keyword_map: map[string]bool = {
+ "int" = true,
+ "uint" = true,
+ "string" = true,
+ "u64" = true,
+ "f32" = true,
+ "f64" = true,
+ "i64" = true,
+ "i32" = true,
+ "bool" = true,
+ "rawptr" = true,
+ "any" = true,
+ "u32" = true,
+ "true" = true,
+ "false" = true,
+ "nil" = true,
+ "byte" = true,
+ "u8" = true,
+ "i8" = true,
+};
+
+bitset_operators: map[string]bool = {
+ "|" = true,
+ "&" = true,
+ "&~" = true,
+ "~" = true,
+ "==" = true,
+ "!=" = true,
+ "<=" = true,
+ "<" = true,
+ ">=" = true,
+ ">" = true,
+};
+
+is_bitset_binary_operator :: proc(op: string) -> bool {
+ return op in bitset_operators;
+} \ No newline at end of file