aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-08-04 21:56:52 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-08-04 21:56:52 +0200
commitd372b697be54b5c958d272f15e023ffa824973b0 (patch)
treea0bb1f39c4d1966840acc927ef8e6562b7319f98 /src
parent7511daac4e7e3e239e96b401955e9b4825ff6607 (diff)
Add support to the new os changes in Odin.
Diffstat (limited to 'src')
-rw-r--r--src/main.odin7
-rw-r--r--src/odin/printer/visit.odin16
-rw-r--r--src/server/references.odin8
-rw-r--r--src/server/workspace_symbols.odin6
4 files changed, 16 insertions, 21 deletions
diff --git a/src/main.odin b/src/main.odin
index 7f399a6..00ed8b0 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -14,19 +14,22 @@ import "core:strings"
import "core:sync"
import "core:thread"
+import "core:sys/windows"
+
import "src:common"
import "src:server"
+
os_read :: proc(handle: rawptr, data: []byte) -> (int, int) {
ptr := cast(^os.Handle)handle
a, b := os.read(ptr^, data)
- return a, cast(int)b
+ return a, cast(int)(b != nil)
}
os_write :: proc(handle: rawptr, data: []byte) -> (int, int) {
ptr := cast(^os.Handle)handle
a, b := os.write(ptr^, data)
- return a, cast(int)b
+ return a, cast(int)(b != nil)
}
//Note(Daniel, Should look into handling errors without crashing from parsing)
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin
index 0861eac..e97735f 100644
--- a/src/odin/printer/visit.odin
+++ b/src/odin/printer/visit.odin
@@ -634,23 +634,17 @@ visit_exprs :: proc(
if .Enforce_Newline in options {
document = cons(
document,
- .Group in options \
- ? group(visit_expr(p, expr, called_from, options)) \
- : visit_expr(p, expr, called_from, options),
+ .Group in options ? group(visit_expr(p, expr, called_from, options)) : visit_expr(p, expr, called_from, options),
)
} else if .Glue in options {
document = cons_with_nopl(
document,
- .Group in options \
- ? group(visit_expr(p, expr, called_from, options)) \
- : visit_expr(p, expr, called_from, options),
+ .Group in options ? group(visit_expr(p, expr, called_from, options)) : visit_expr(p, expr, called_from, options),
)
} else {
document = cons_with_opl(
document,
- .Group in options \
- ? group(visit_expr(p, expr, called_from, options)) \
- : visit_expr(p, expr, called_from, options),
+ .Group in options ? group(visit_expr(p, expr, called_from, options)) : visit_expr(p, expr, called_from, options),
)
}
@@ -2898,9 +2892,7 @@ visit_signature_list :: proc(
} else {
if .Enforce_Newline not_in options {
document =
- len(list.list) > 1 || contains_body \
- ? cons(document, if_break(",")) \
- : document
+ len(list.list) > 1 || contains_body ? cons(document, if_break(",")) : document
} else {
document = cons(document, text(","))
}
diff --git a/src/server/references.odin b/src/server/references.odin
index 17add83..a80164d 100644
--- a/src/server/references.odin
+++ b/src/server/references.odin
@@ -22,17 +22,17 @@ walk_directories :: proc(
in_err: os.Errno,
user_data: rawptr,
) -> (
- err: os.Errno,
+ err: os.Error,
skip_dir: bool,
) {
document := cast(^Document)user_data
if info.is_dir {
- return 0, false
+ return nil, false
}
if info.fullpath == "" {
- return 0, false
+ return nil, false
}
if strings.contains(info.name, ".odin") {
@@ -48,7 +48,7 @@ walk_directories :: proc(
}
}
- return 0, false
+ return nil, false
}
prepare_references :: proc(
diff --git a/src/server/workspace_symbols.odin b/src/server/workspace_symbols.odin
index 0ce8be1..cf2f435 100644
--- a/src/server/workspace_symbols.odin
+++ b/src/server/workspace_symbols.odin
@@ -14,7 +14,7 @@ walk_dir :: proc(
in_err: os.Errno,
user_data: rawptr,
) -> (
- err: os.Errno,
+ err: os.Error,
skip_dir: bool,
) {
pkgs := cast(^[dynamic]string)user_data
@@ -24,7 +24,7 @@ walk_dir :: proc(
append(pkgs, dir)
}
- return 0, false
+ return nil, false
}
get_workspace_symbols :: proc(
@@ -56,7 +56,7 @@ get_workspace_symbols :: proc(
for result in results {
symbol := WorkspaceSymbol {
name = result.symbol.name,
- location = {
+ location = {
range = result.symbol.range,
uri = result.symbol.uri,
},