aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-03-24 20:10:39 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-03-24 20:10:39 +0100
commitd4ccf4e2e7a0a0e5775059c6f4f0a7e61703b724 (patch)
tree715750fbc495e9314f8df3d330195e5619c7c9aa /src
parentb7641c4c9045dc0a6eda631043ae1549f60855d7 (diff)
Support the new json change from odin
Diffstat (limited to 'src')
-rw-r--r--src/odin/printer/visit.odin4
-rw-r--r--src/server/requests.odin36
-rw-r--r--src/server/response.odin6
-rw-r--r--src/server/unmarshal.odin12
4 files changed, 29 insertions, 29 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin
index da60e48..222bb0b 100644
--- a/src/odin/printer/visit.odin
+++ b/src/odin/printer/visit.odin
@@ -1050,10 +1050,10 @@ visit_expr :: proc(p: ^Printer, expr: ^ast.Expr, called_from: Expr_Called_Type =
document = cons(document, visit_poly_params(p, v.poly_params))
- if v.is_maybe {
+ if v.kind == .maybe {
document = cons_with_opl(document, text("#maybe"))
}
-
+
document = cons_with_nopl(document, push_where_clauses(p, v.where_clauses))
if len(v.variants) == 0 {
diff --git a/src/server/requests.odin b/src/server/requests.odin
index 38e390f..93fa01a 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -362,7 +362,7 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
initialize_params: RequestInitializeParams
- if unmarshal(params, initialize_params, context.temp_allocator) != .None {
+ if unmarshal(params, initialize_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -384,7 +384,7 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C
},
}
- if unmarshal(value, ols_config, context.temp_allocator) == .None {
+ if unmarshal(value, ols_config, context.temp_allocator) == nil {
config.thread_count = ols_config.thread_pool_count
config.enable_document_symbols = ols_config.enable_document_symbols
@@ -580,7 +580,7 @@ request_definition :: proc (params: json.Value, id: RequestId, config: ^common.C
definition_params: TextDocumentPositionParams
- if unmarshal(params, definition_params, context.temp_allocator) != .None {
+ if unmarshal(params, definition_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -616,7 +616,7 @@ request_completion :: proc (params: json.Value, id: RequestId, config: ^common.C
completition_params: CompletionParams
- if unmarshal(params, completition_params, context.temp_allocator) != .None {
+ if unmarshal(params, completition_params, context.temp_allocator) != nil {
log.error("Failed to unmarshal completion request")
return .ParseError
}
@@ -650,7 +650,7 @@ request_signature_help :: proc (params: json.Value, id: RequestId, config: ^comm
signature_params: SignatureHelpParams
- if unmarshal(params, signature_params, context.temp_allocator) != .None {
+ if unmarshal(params, signature_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -688,7 +688,7 @@ request_format_document :: proc (params: json.Value, id: RequestId, config: ^com
format_params: DocumentFormattingParams
- if unmarshal(params, format_params, context.temp_allocator) != .None {
+ if unmarshal(params, format_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -727,7 +727,7 @@ notification_did_open :: proc (params: json.Value, id: RequestId, config: ^commo
open_params: DidOpenTextDocumentParams
- if unmarshal(params, open_params, context.allocator) != .None {
+ if unmarshal(params, open_params, context.allocator) != nil {
log.error("Failed to parse open document notification")
return .ParseError
}
@@ -748,7 +748,7 @@ notification_did_change :: proc (params: json.Value, id: RequestId, config: ^com
change_params: DidChangeTextDocumentParams
- if unmarshal(params, change_params, context.temp_allocator) != .None {
+ if unmarshal(params, change_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -766,11 +766,11 @@ notification_did_close :: proc(params: json.Value, id: RequestId, config: ^commo
close_params: DidCloseTextDocumentParams
- if unmarshal(params, close_params, context.temp_allocator) != .None {
+ if unmarshal(params, close_params, context.temp_allocator) != nil {
return .ParseError
}
- if n := document_close(close_params.textDocument.uri); n != .None {
+ if n := document_close(close_params.textDocument.uri); n != nil {
return .InternalError
}
@@ -786,7 +786,7 @@ notification_did_save :: proc (params: json.Value, id: RequestId, config: ^commo
save_params: DidSaveTextDocumentParams
- if unmarshal(params, save_params, context.temp_allocator) != .None {
+ if unmarshal(params, save_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -856,7 +856,7 @@ request_semantic_token_full :: proc (params: json.Value, id: RequestId, config:
semantic_params: SemanticTokensParams
- if unmarshal(params, semantic_params, context.temp_allocator) != .None {
+ if unmarshal(params, semantic_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -901,7 +901,7 @@ request_semantic_token_range :: proc (params: json.Value, id: RequestId, config:
semantic_params: SemanticTokensRangeParams
- if unmarshal(params, semantic_params, context.temp_allocator) != .None {
+ if unmarshal(params, semantic_params, context.temp_allocator) != nil {
return .None
}
@@ -935,7 +935,7 @@ request_document_symbols :: proc (params: json.Value, id: RequestId, config: ^co
symbol_params: DocumentSymbolParams
- if unmarshal(params, symbol_params, context.temp_allocator) != .None {
+ if unmarshal(params, symbol_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -963,7 +963,7 @@ request_hover :: proc (params: json.Value, id: RequestId, config: ^common.Config
hover_params: HoverParams
- if unmarshal(params, hover_params, context.temp_allocator) != .None {
+ if unmarshal(params, hover_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -996,7 +996,7 @@ request_inlay_hint :: proc (params: json.Value, id: RequestId, config: ^common.C
inlay_params: InlayParams
- if unmarshal(params, inlay_params, context.temp_allocator) != .None {
+ if unmarshal(params, inlay_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -1034,7 +1034,7 @@ request_document_links :: proc (params: json.Value, id: RequestId, config: ^comm
link_params: DocumentLinkParams
- if unmarshal(params, link_params, context.temp_allocator) != .None {
+ if unmarshal(params, link_params, context.temp_allocator) != nil {
return .ParseError
}
@@ -1068,7 +1068,7 @@ request_rename :: proc (params: json.Value, id: RequestId, config: ^common.Confi
rename_param: RenameParams
- if unmarshal(params, rename_param, context.temp_allocator) != .None {
+ if unmarshal(params, rename_param, context.temp_allocator) != nil {
return .ParseError
}
diff --git a/src/server/response.odin b/src/server/response.odin
index 7c07f41..8cbd410 100644
--- a/src/server/response.odin
+++ b/src/server/response.odin
@@ -9,7 +9,7 @@ send_notification :: proc (notification: Notification, writer: ^Writer) -> bool
header := fmt.tprintf("Content-Length: %v\r\n\r\n", len(data))
- if error != .None {
+ if error != nil {
return false
}
@@ -30,7 +30,7 @@ send_response :: proc (response: ResponseMessage, writer: ^Writer) -> bool {
header := fmt.tprintf("Content-Length: %v\r\n\r\n", len(data))
- if error != .None {
+ if error != nil {
return false
}
@@ -51,7 +51,7 @@ send_error :: proc (response: ResponseMessageError, writer: ^Writer) -> bool {
header := fmt.tprintf("Content-Length: %v\r\n\r\n", len(data))
- if error != .None {
+ if error != nil {
return false
}
diff --git a/src/server/unmarshal.odin b/src/server/unmarshal.odin
index c8a8071..3910115 100644
--- a/src/server/unmarshal.odin
+++ b/src/server/unmarshal.odin
@@ -15,11 +15,11 @@ unmarshal :: proc(json_value: json.Value, v: any, allocator: mem.Allocator) -> j
using runtime
if v == nil {
- return .None
+ return nil
}
if json_value == nil {
- return .None
+ return nil
}
type_info := type_info_base(type_info_of(v.id))
@@ -33,11 +33,11 @@ unmarshal :: proc(json_value: json.Value, v: any, allocator: mem.Allocator) -> j
//TEMP most likely have to rewrite the entire unmarshal using tags instead, because i sometimes have to support names like 'context', which can't be written like that
if field[len(field)-1] == '_' {
- if ret := unmarshal(j[field[:len(field)-1]], a, allocator); ret != .None {
+ if ret := unmarshal(j[field[:len(field)-1]], a, allocator); ret != nil {
return ret
}
} else {
- if ret := unmarshal(j[field], a, allocator); ret != .None {
+ if ret := unmarshal(j[field], a, allocator); ret != nil {
return ret
}
}
@@ -77,7 +77,7 @@ unmarshal :: proc(json_value: json.Value, v: any, allocator: mem.Allocator) -> j
for i in 0..<array.len {
a := any {rawptr(uintptr(array.data) + uintptr(variant.elem_size * i)), variant.elem.id}
- if ret := unmarshal(j[i], a, allocator); ret != .None {
+ if ret := unmarshal(j[i], a, allocator); ret != nil {
return ret
}
}
@@ -153,5 +153,5 @@ unmarshal :: proc(json_value: json.Value, v: any, allocator: mem.Allocator) -> j
return .Unsupported_Type
}
- return .None
+ return nil
}