aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-02-22 20:46:13 +0100
committerDanielGavin <danielgavin5@hotmail.com>2024-02-22 20:46:13 +0100
commitacb232ac94f46d6c1b81378ab0be0c5b2f91a446 (patch)
tree50519c8b5f4847e73da0712c3ae801c2a184c434
parenta75c3424a6003f1ccbfbf6f170009ebf7bf18e4e (diff)
Automatically add shared collection.
-rw-r--r--.vscode/c_cpp_properties.json21
-rw-r--r--.vscode/launch.json20
-rw-r--r--build.bat12
-rwxr-xr-xbuild.sh10
-rw-r--r--editors/vscode/package-lock.json4
-rw-r--r--editors/vscode/package.json7
-rw-r--r--editors/vscode/src/config.ts8
-rw-r--r--editors/vscode/src/extension.ts10
-rw-r--r--odinfmt.bat2
-rwxr-xr-xodinfmt.sh2
-rw-r--r--ols.json13
-rw-r--r--src/main.odin12
-rw-r--r--src/odin/format/format.odin2
-rw-r--r--src/server/analysis.odin2
-rw-r--r--src/server/build.odin6
-rw-r--r--src/server/caches.odin2
-rw-r--r--src/server/check.odin16
-rw-r--r--src/server/collector.odin2
-rw-r--r--src/server/completion.odin59
-rw-r--r--src/server/definition.odin2
-rw-r--r--src/server/document_links.odin22
-rw-r--r--src/server/document_symbols.odin20
-rw-r--r--src/server/documents.odin22
-rw-r--r--src/server/format.odin6
-rw-r--r--src/server/generics.odin14
-rw-r--r--src/server/hover.odin21
-rw-r--r--src/server/inlay_hints.odin4
-rw-r--r--src/server/lens.odin2
-rw-r--r--src/server/memory_index.odin6
-rw-r--r--src/server/methods.odin2
-rw-r--r--src/server/references.odin8
-rw-r--r--src/server/rename.odin11
-rw-r--r--src/server/requests.odin18
-rw-r--r--src/server/semantic_tokens.odin2
-rw-r--r--src/server/signature.odin16
-rw-r--r--src/server/symbol.odin2
-rw-r--r--src/server/types.odin2
-rw-r--r--src/server/workspace_symbols.odin10
-rw-r--r--src/testing/testing.odin18
-rw-r--r--tests/completions_test.odin81
-rw-r--r--tests/definition_test.odin10
-rw-r--r--tests/hover_test.odin12
-rw-r--r--tests/references_test.odin4
-rw-r--r--tests/session_test.odin6
-rw-r--r--tests/signatures_test.odin56
-rw-r--r--tools/odinfmt/main.odin14
-rw-r--r--tools/odinfmt/snapshot/snapshot.odin2
-rw-r--r--tools/odinfmt/tests.bat2
-rwxr-xr-xtools/odinfmt/tests.sh2
49 files changed, 357 insertions, 250 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..c78c930
--- /dev/null
+++ b/.vscode/c_cpp_properties.json
@@ -0,0 +1,21 @@
+{
+ "configurations": [
+ {
+ "name": "Win32",
+ "includePath": [
+ "${workspaceFolder}/**"
+ ],
+ "defines": [
+ "_DEBUG",
+ "UNICODE",
+ "_UNICODE"
+ ],
+ "windowsSdkVersion": "10.0.22000.0",
+ "compilerPath": "cl.exe",
+ "cStandard": "c17",
+ "cppStandard": "c++17",
+ "intelliSenseMode": "windows-msvc-x64"
+ }
+ ],
+ "version": 4
+} \ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..e2ecda4
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,20 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "cppvsdbg",
+ "request": "attach",
+ "name": "Attach OLS",
+ "processId": "${command:pickProcess}"
+ }
+ {
+ "type": "cppvsdbg",
+ "request": "launch",
+ "name": "Run unit",
+ "program": "C:\\Users\\Daniel\\Desktop\\Computer_Science\\ols\\test_unit.exe",
+ }
+ ]
+} \ No newline at end of file
diff --git a/build.bat b/build.bat
index 12ec3b3..a34a1d0 100644
--- a/build.bat
+++ b/build.bat
@@ -4,19 +4,19 @@ setlocal enabledelayedexpansion
if "%1" == "CI" (
set "PATH=%cd%\Odin;!PATH!"
- rem odin test tests -collection:shared=src
+ rem odin test tests -collection:src=src
rem if %errorlevel% neq 0 exit 1
- odin build src\ -collection:shared=src -out:ols.exe -o:speed
+ odin build src\ -collection:src=src -out:ols.exe -o:speed
call "tools/odinfmt/tests.bat"
if %errorlevel% neq 0 exit 1
) else if "%1" == "test" (
- odin test tests -collection:shared=src -debug
+ odin test tests -collection:src=src -debug
) else if "%1" == "single_test" (
- odin test tests -collection:shared=src -test-name:%2
+ odin test tests -collection:src=src -test-name:%2
) else if "%1" == "debug" (
- odin build src\ -show-timings -collection:shared=src -microarch:native -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug
+ odin build src\ -show-timings -collection:src=src -microarch:native -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug
) else (
- odin build src\ -show-timings -microarch:native -collection:shared=src -out:ols.exe -o:speed -no-bounds-check
+ odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:speed -no-bounds-check
)
diff --git a/build.sh b/build.sh
index c5e78f5..0041c6f 100755
--- a/build.sh
+++ b/build.sh
@@ -9,7 +9,7 @@ then
#BUG in odin test, it makes the executable with the same name as a folder and gets confused.
cd tests
- odin test ../tests -collection:shared=../src -o:speed $@
+ odin test ../tests -collection:src=../src -o:speed $@
if ([ $? -ne 0 ])
then
@@ -41,7 +41,7 @@ then
#BUG in odin test, it makes the executable with the same name as a folder and gets confused.
cd tests
- odin test ../tests -collection:shared=../src -test-name:$@
+ odin test ../tests -collection:src=../src -test-name:$@
shift
@@ -61,7 +61,7 @@ then
#BUG in odin test, it makes the executable with the same name as a folder and gets confused.
cd tests
- odin test ../tests -collection:shared=../src $@
+ odin test ../tests -collection:src=../src $@
if ([ $? -ne 0 ])
then
@@ -75,9 +75,9 @@ if [[ $1 == "debug" ]]
then
shift
- odin build src/ -collection:shared=src -out:ols -use-separate-modules -debug $@
+ odin build src/ -collection:src=src -out:ols -use-separate-modules -debug $@
exit 0
fi
-odin build src/ -collection:shared=src -out:ols -o:speed $@
+odin build src/ -collection:src=src -out:ols -o:speed $@
diff --git a/editors/vscode/package-lock.json b/editors/vscode/package-lock.json
index 589200b..6d2309e 100644
--- a/editors/vscode/package-lock.json
+++ b/editors/vscode/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "ols",
- "version": "0.1.15",
+ "version": "0.1.26",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ols",
- "version": "0.1.15",
+ "version": "0.1.26",
"dependencies": {
"adm-zip": "^0.5.9",
"https-proxy-agent": "^5.0.0",
diff --git a/editors/vscode/package.json b/editors/vscode/package.json
index b50d575..abbd4d7 100644
--- a/editors/vscode/package.json
+++ b/editors/vscode/package.json
@@ -7,7 +7,7 @@
"type": "git",
"url": "git://github.com/DanielGavin/ols.git"
},
- "version": "0.1.23",
+ "version": "0.1.27",
"engines": {
"vscode": "^1.66.0"
},
@@ -46,6 +46,11 @@
"type": "object",
"title": "Odin language client configuration",
"properties": {
+ "ols.prompt.AskCreateOLS": {
+ "type": "boolean",
+ "default": true,
+ "description": "Ask if it should create an ols.json file if it's not in the project."
+ },
"ols.updates.askBeforeDownload": {
"type": "boolean",
"default": true,
diff --git a/editors/vscode/src/config.ts b/editors/vscode/src/config.ts
index 8508d6e..af93db8 100644
--- a/editors/vscode/src/config.ts
+++ b/editors/vscode/src/config.ts
@@ -1,8 +1,6 @@
import * as vscode from 'vscode';
import { log } from "./util";
-//modified from https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/config.ts - 03.05.2021
-
export class Config {
readonly extensionId = "danielgavin.ols";
@@ -45,5 +43,11 @@ export class Config {
get debugEngine() { return this.get<string>("debug.engine"); }
+ get askCreateOLS() { return this.get<boolean>("prompt.AskCreateOLS"); }
+
+ public updateAskCreateOLS(ask: boolean) {
+ this.cfg.update("prompt.AskCreateOLS", ask, vscode.ConfigurationTarget.Global);
+ }
+
collections: any [] = [];
}
diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts
index 0dd4268..f7ad636 100644
--- a/editors/vscode/src/extension.ts
+++ b/editors/vscode/src/extension.ts
@@ -107,14 +107,22 @@ export async function activate(context: vscode.ExtensionContext) {
fs.access(olsFile, constants.F_OK).catch(async err => {
if (err) {
+ if (!config.askCreateOLS) {
+ return;
+ }
+
const userResponse = await vscode.window.showInformationMessage(
"No ols config file in the workspace root folder. Do you wish to create one?",
"Yes",
- "No"
+ "No",
+ "Don't ask again"
);
if (userResponse === "Yes") {
createOlsConfig(ctx);
+ } else if (userResponse === "Don't ask again") {
+ config.updateAskCreateOLS(false);
+ return;
}
}
diff --git a/odinfmt.bat b/odinfmt.bat
index c31e434..5eb7b56 100644
--- a/odinfmt.bat
+++ b/odinfmt.bat
@@ -1 +1 @@
-odin build tools/odinfmt/main.odin -file -show-timings -collection:shared=src -out:odinfmt.exe -o:speed
+odin build tools/odinfmt/main.odin -file -show-timings -collection:src=src -out:odinfmt.exe -o:speed
diff --git a/odinfmt.sh b/odinfmt.sh
index 53c9d80..449d8b4 100755
--- a/odinfmt.sh
+++ b/odinfmt.sh
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
-odin build tools/odinfmt/main.odin -file -show-timings -collection:shared=src -out:odinfmt -o:speed
+odin build tools/odinfmt/main.odin -file -show-timings -collection:src=src -out:odinfmt -o:speed
diff --git a/ols.json b/ols.json
index 5261a9c..477305c 100644
--- a/ols.json
+++ b/ols.json
@@ -1,13 +1,22 @@
{
+ "$schema": "https://raw.githubusercontent.com/DanielGavin/ols/master/misc/ols.schema.json",
"collections": [
{
- "name": "shared",
+ "name": "src",
"path": "src"
}
],
+ "profiles": [
+ { "name": "linux_profile", "os": "linux", "checker_path": ["src/main.odin"]},
+ { "name": "windows_profile", "os": "windows", "checker_path": ["src/main.odin", "src"]}
+ ],
+ "profile": "windows_profile",
"enable_document_symbols": true,
"enable_semantic_tokens": true,
"enable_snippets": true,
"enable_references": true,
+ "enable_fake_methods": false,
+ "enable_inlay_hints": false,
+ "enable_procedure_snippet": false,
"verbose": false
-}
+} \ No newline at end of file
diff --git a/src/main.odin b/src/main.odin
index 910d0be..693890b 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -1,21 +1,21 @@
package main
+import "core:encoding/json"
import "core:fmt"
import "core:log"
import "core:mem"
import "core:os"
-import "core:strings"
+import "core:reflect"
import "core:slice"
import "core:strconv"
-import "core:thread"
-import "core:encoding/json"
-import "core:reflect"
+import "core:strings"
import "core:sync"
+import "core:thread"
import "core:intrinsics"
-import "shared:server"
-import "shared:common"
+import "src:common"
+import "src:server"
os_read :: proc(handle: rawptr, data: []byte) -> (int, int) {
ptr := cast(^os.Handle)handle
diff --git a/src/odin/format/format.odin b/src/odin/format/format.odin
index 1b86148..468f6de 100644
--- a/src/odin/format/format.odin
+++ b/src/odin/format/format.odin
@@ -6,7 +6,7 @@ import "core:odin/ast"
import "core:odin/parser"
import "core:os"
import "core:path/filepath"
-import "shared:odin/printer"
+import "src:odin/printer"
default_style := printer.default_style
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 595551b..2e3839c 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -15,7 +15,7 @@ import "core:strconv"
import "core:strings"
import "core:unicode/utf8"
-import "shared:common"
+import "src:common"
DocumentPositionContextHint :: enum {
Completion,
diff --git a/src/server/build.odin b/src/server/build.odin
index b6483cc..54ec93a 100644
--- a/src/server/build.odin
+++ b/src/server/build.odin
@@ -13,7 +13,7 @@ import "core:runtime"
import "core:strings"
import "core:time"
-import "shared:common"
+import "src:common"
platform_os: map[string]bool = {
"windows" = true,
@@ -95,8 +95,8 @@ try_build_package :: proc(pkg_name: string) {
}
p := parser.Parser {
- err = log_error_handler,
- warn = log_warning_handler,
+ err = log_error_handler,
+ warn = log_warning_handler,
flags = {.Optional_Semicolons},
}
diff --git a/src/server/caches.odin b/src/server/caches.odin
index 87da04d..d286624 100644
--- a/src/server/caches.odin
+++ b/src/server/caches.odin
@@ -1,6 +1,6 @@
package server
-import "shared:common"
+import "src:common"
import "core:time"
diff --git a/src/server/check.odin b/src/server/check.odin
index 73aef75..d041320 100644
--- a/src/server/check.odin
+++ b/src/server/check.odin
@@ -16,7 +16,7 @@ import "core:sync"
import "core:text/scanner"
import "core:thread"
-import "shared:common"
+import "src:common"
//Store uris we have reported on since last save. We use this to clear them on next save.
uris_reported := make([dynamic]string)
@@ -119,7 +119,10 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
}
}
- error.uri = strings.clone(string(buffer[source_pos:s.src_pos - 1]), context.temp_allocator)
+ error.uri = strings.clone(
+ string(buffer[source_pos:s.src_pos - 1]),
+ context.temp_allocator,
+ )
left_paren := scanner.scan(&s)
@@ -147,7 +150,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
if seperator != ':' {
break scan_line
}
-
+
rhs_digit := scanner.scan(&s)
if rhs_digit != scanner.Int {
@@ -159,7 +162,7 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
if !ok {
break scan_line
}
-
+
right_paren := scanner.scan(&s)
if right_paren != ')' {
@@ -180,7 +183,10 @@ check :: proc(paths: []string, writer: ^Writer, config: ^common.Config) {
continue
}
- error.message = strings.clone(string(buffer[source_pos:s.src_pos - 1]), context.temp_allocator)
+ error.message = strings.clone(
+ string(buffer[source_pos:s.src_pos - 1]),
+ context.temp_allocator,
+ )
error.column = column
error.line = line
diff --git a/src/server/collector.odin b/src/server/collector.odin
index 5d91039..935acd7 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -10,7 +10,7 @@ import path "core:path/slashpath"
import "core:strconv"
import "core:strings"
-import "shared:common"
+import "src:common"
SymbolCollection :: struct {
allocator: mem.Allocator,
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 6bf253a..2f5c1ce 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -15,7 +15,7 @@ import "core:strconv"
import "core:strings"
-import "shared:common"
+import "src:common"
/*
TODOS: Making the signature details is really annoying and not that nice - try to see if this can be refractored.
@@ -522,21 +522,18 @@ get_selector_completion :: proc(
list.isIncomplete = false
enumv, ok := unwrap_bitset(ast_context, selector)
- if !ok { break }
+ if !ok {break}
range, rok := get_range_from_selection_start_to_dot(position_context)
- if !rok { break }
+ if !rok {break}
range.end.character -= 1
variable, vok := position_context.selector.derived_expr.(^ast.Ident)
- if !vok { break }
+ if !vok {break}
remove_edit := TextEdit {
- range = {
- start = range.start,
- end = range.end,
- },
+ range = {start = range.start, end = range.end},
newText = "",
}
@@ -544,12 +541,15 @@ get_selector_completion :: proc(
additionalTextEdits[0] = remove_edit
for name in enumv.names {
- append(&items, CompletionItem {
- label = fmt.tprintf(".%s", name),
- kind = .EnumMember,
- detail = fmt.tprintf("%s.%s", selector.name, name),
- additionalTextEdits = additionalTextEdits,
- })
+ append(
+ &items,
+ CompletionItem {
+ label = fmt.tprintf(".%s", name),
+ kind = .EnumMember,
+ detail = fmt.tprintf("%s.%s", selector.name, name),
+ additionalTextEdits = additionalTextEdits,
+ },
+ )
}
case SymbolStructValue:
@@ -884,7 +884,10 @@ get_implicit_completion :: proc(
elem_index := -1
for elem, i in comp_lit.elems {
- if position_in_node(elem, position_context.position) {
+ if position_in_node(
+ elem,
+ position_context.position,
+ ) {
elem_index = i
}
}
@@ -904,7 +907,8 @@ get_implicit_completion :: proc(
type = s.types[elem_index]
}
- if enum_value, ok := unwrap_enum(ast_context, type); ok {
+ if enum_value, ok := unwrap_enum(ast_context, type);
+ ok {
for enum_name in enum_value.names {
item := CompletionItem {
label = enum_name,
@@ -1129,7 +1133,7 @@ get_implicit_completion :: proc(
list.items = items[:]
return
}
-
+
// Bitset comp literal in parameter, eg: `hello({ . })`.
if position_context.comp_lit != nil {
if bitset_symbol, ok := resolve_type_expression(
@@ -1763,14 +1767,22 @@ append_magic_map_completion :: proc(
append(items, item)
}
}
-get_expression_string_from_position_context :: proc(position_context: ^DocumentPositionContext) -> string {
+get_expression_string_from_position_context :: proc(
+ position_context: ^DocumentPositionContext,
+) -> string {
src := position_context.file.src
if position_context.call != nil {
- return src[position_context.call.pos.offset:position_context.call.end.offset]
+ return(
+ src[position_context.call.pos.offset:position_context.call.end.offset] \
+ )
} else if position_context.field != nil {
- return src[position_context.field.pos.offset:position_context.field.end.offset]
+ return(
+ src[position_context.field.pos.offset:position_context.field.end.offset] \
+ )
} else if position_context.selector != nil {
- return src[position_context.selector.pos.offset:position_context.selector.end.offset]
+ return(
+ src[position_context.selector.pos.offset:position_context.selector.end.offset] \
+ )
}
return ""
}
@@ -1826,10 +1838,7 @@ append_magic_dynamic_array_completion :: proc(
detail = "for",
additionalTextEdits = additionalTextEdits,
textEdit = TextEdit {
- newText = fmt.tprintf(
- "for i in %v {{\n\t$0 \n}}",
- symbol_str,
- ),
+ newText = fmt.tprintf("for i in %v {{\n\t$0 \n}}", symbol_str),
range = {start = range.end, end = range.end},
},
insertTextFormat = .Snippet,
diff --git a/src/server/definition.odin b/src/server/definition.odin
index 8c0a567..021a556 100644
--- a/src/server/definition.odin
+++ b/src/server/definition.odin
@@ -14,7 +14,7 @@ import "core:sort"
import "core:strconv"
import "core:strings"
-import "shared:common"
+import "src:common"
get_all_package_file_locations :: proc(
document: ^Document,
diff --git a/src/server/document_links.odin b/src/server/document_links.odin
index 17113ff..4b2acf5 100644
--- a/src/server/document_links.odin
+++ b/src/server/document_links.odin
@@ -1,21 +1,21 @@
package server
-import "core:odin/parser"
-import "core:odin/ast"
-import "core:odin/tokenizer"
import "core:fmt"
import "core:log"
-import "core:strings"
-import path "core:path/slashpath"
import "core:mem"
-import "core:strconv"
+import "core:odin/ast"
+import "core:odin/parser"
+import "core:odin/tokenizer"
+import "core:os"
import "core:path/filepath"
-import "core:sort"
+import path "core:path/slashpath"
import "core:slice"
-import "core:os"
+import "core:sort"
+import "core:strconv"
+import "core:strings"
-import "shared:common"
+import "src:common"
get_document_links :: proc(document: ^Document) -> ([]DocumentLink, bool) {
links := make([dynamic]DocumentLink, 0, context.temp_allocator)
@@ -41,12 +41,12 @@ get_document_links :: proc(document: ^Document) -> ([]DocumentLink, bool) {
//Temporarly assuming non unicode
node := ast.Node {
- pos = {
+ pos = {
offset = imp.relpath.pos.offset + 1,
column = imp.relpath.pos.column + 1,
line = imp.relpath.pos.line,
},
- end = {
+ end = {
offset = imp.relpath.pos.offset + len(imp.relpath.text) - 1,
column = imp.relpath.pos.column + len(imp.relpath.text) - 1,
line = imp.relpath.pos.line,
diff --git a/src/server/document_symbols.odin b/src/server/document_symbols.odin
index 1219413..334bb6e 100644
--- a/src/server/document_symbols.odin
+++ b/src/server/document_symbols.odin
@@ -1,21 +1,21 @@
package server
-import "core:odin/parser"
-import "core:odin/ast"
-import "core:odin/tokenizer"
import "core:fmt"
import "core:log"
-import "core:strings"
-import path "core:path/slashpath"
import "core:mem"
-import "core:strconv"
+import "core:odin/ast"
+import "core:odin/parser"
+import "core:odin/tokenizer"
+import "core:os"
import "core:path/filepath"
-import "core:sort"
+import path "core:path/slashpath"
import "core:slice"
-import "core:os"
+import "core:sort"
+import "core:strconv"
+import "core:strings"
-import "shared:common"
+import "src:common"
get_document_symbols :: proc(document: ^Document) -> []DocumentSymbol {
ast_context := make_ast_context(
@@ -44,7 +44,7 @@ get_document_symbols :: proc(document: ^Document) -> []DocumentSymbol {
)
package_symbol.range = {
start = {line = document.ast.decls[0].pos.line},
- end = {
+ end = {
line = document.ast.decls[len(document.ast.decls) - 1].end.line,
},
}
diff --git a/src/server/documents.odin b/src/server/documents.odin
index 5553fae..e2cc322 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -1,19 +1,19 @@
package server
-import "core:strings"
import "core:fmt"
import "core:log"
-import "core:os"
-import "core:odin/parser"
+import "core:mem"
import "core:odin/ast"
+import "core:odin/parser"
import "core:odin/tokenizer"
+import "core:os"
import "core:path/filepath"
import path "core:path/slashpath"
-import "core:mem"
+import "core:strings"
import "core:intrinsics"
-import "shared:common"
+import "src:common"
ParserError :: struct {
message: string,
@@ -351,8 +351,8 @@ document_refresh :: proc(
for error, i in errors {
params.diagnostics[i] = Diagnostic {
- range = common.Range{
- start = common.Position{
+ range = common.Range {
+ start = common.Position {
line = error.line - 1,
character = 0,
},
@@ -380,7 +380,7 @@ document_refresh :: proc(
notifaction := Notification {
jsonrpc = "2.0",
method = "textDocument/publishDiagnostics",
- params = NotificationPublishDiagnosticsParams{
+ params = NotificationPublishDiagnosticsParams {
uri = document.uri.uri,
diagnostics = make(
[]Diagnostic,
@@ -420,8 +420,8 @@ parse_document :: proc(
bool,
) {
p := parser.Parser {
- err = parser_error_handler,
- warn = common.parser_warning_handler,
+ err = parser_error_handler,
+ warn = common.parser_warning_handler,
flags = {.Optional_Semicolons},
}
@@ -502,7 +502,7 @@ parse_imports :: proc(document: ^Document, config: ^common.Config) {
import_: Package
import_.original = imp.fullpath
import_.name = path.join(
- elems = {
+ elems = {
document.package_name,
imp.fullpath[1:len(imp.fullpath) - 1],
},
diff --git a/src/server/format.odin b/src/server/format.odin
index 63d949c..fbf9837 100644
--- a/src/server/format.odin
+++ b/src/server/format.odin
@@ -1,9 +1,9 @@
package server
-import "shared:common"
-import "shared:odin/printer"
-import "shared:odin/format"
import "core:path/filepath"
+import "src:common"
+import "src:odin/format"
+import "src:odin/printer"
import "core:log"
diff --git a/src/server/generics.odin b/src/server/generics.odin
index 50a477a..046793d 100644
--- a/src/server/generics.odin
+++ b/src/server/generics.odin
@@ -15,7 +15,7 @@ import "core:strconv"
import "core:strings"
import "core:unicode/utf8"
-import "shared:common"
+import "src:common"
resolve_poly :: proc(
ast_context: ^AstContext,
@@ -439,8 +439,16 @@ resolve_generic_function_symbol :: proc(
return {}, false
}
- symbol_expr = clone_expr(symbol_expr, ast_context.allocator, nil)
- param_type := clone_expr(param.type, ast_context.allocator, nil)
+ symbol_expr = clone_expr(
+ symbol_expr,
+ ast_context.allocator,
+ nil,
+ )
+ param_type := clone_expr(
+ param.type,
+ ast_context.allocator,
+ nil,
+ )
if resolve_poly(
ast_context,
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 2dfdee4..be6adad 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -1,19 +1,19 @@
package server
-import "core:odin/parser"
-import "core:odin/ast"
-import "core:odin/tokenizer"
import "core:fmt"
import "core:log"
-import "core:strings"
-import path "core:path/slashpath"
import "core:mem"
-import "core:strconv"
+import "core:odin/ast"
+import "core:odin/parser"
+import "core:odin/tokenizer"
import "core:path/filepath"
-import "core:sort"
+import path "core:path/slashpath"
import "core:slice"
+import "core:sort"
+import "core:strconv"
+import "core:strings"
-import "shared:common"
+import "src:common"
write_hover_content :: proc(
ast_context: ^AstContext,
@@ -125,9 +125,8 @@ get_hover_information :: proc(
if position_context.implicit_context != nil {
if str, ok :=
- builtin_identifier_hover[
- position_context.implicit_context.tok.text \
- ]; ok {
+ builtin_identifier_hover[position_context.implicit_context.tok.text];
+ ok {
hover.contents.kind = "markdown"
hover.contents.value = str
hover.range = common.get_token_range(
diff --git a/src/server/inlay_hints.odin b/src/server/inlay_hints.odin
index 26e84c3..8085baa 100644
--- a/src/server/inlay_hints.odin
+++ b/src/server/inlay_hints.odin
@@ -1,10 +1,10 @@
package server
-import "core:odin/ast"
import "core:fmt"
import "core:log"
+import "core:odin/ast"
-import "shared:common"
+import "src:common"
get_inlay_hints :: proc(
document: ^Document,
diff --git a/src/server/lens.odin b/src/server/lens.odin
index 99eaea3..3206d6d 100644
--- a/src/server/lens.odin
+++ b/src/server/lens.odin
@@ -3,7 +3,7 @@ package server
import "core:odin/ast"
-import "shared:common"
+import "src:common"
CodeLensClientCapabilities :: struct {
diff --git a/src/server/memory_index.odin b/src/server/memory_index.odin
index d803a24..ee151dc 100644
--- a/src/server/memory_index.odin
+++ b/src/server/memory_index.odin
@@ -1,12 +1,12 @@
package server
-import "core:hash"
-import "core:strings"
import "core:fmt"
+import "core:hash"
import "core:log"
import "core:slice"
+import "core:strings"
-import "shared:common"
+import "src:common"
MemoryIndex :: struct {
collection: SymbolCollection,
diff --git a/src/server/methods.odin b/src/server/methods.odin
index 62d2cb4..7d8c698 100644
--- a/src/server/methods.odin
+++ b/src/server/methods.odin
@@ -15,7 +15,7 @@ import "core:strconv"
import "core:strings"
-import "shared:common"
+import "src:common"
@(private)
diff --git a/src/server/references.odin b/src/server/references.odin
index 7c9e2cb..2016351 100644
--- a/src/server/references.odin
+++ b/src/server/references.odin
@@ -1,7 +1,7 @@
package server
-import "shared:common"
+import "src:common"
import "core:fmt"
import "core:log"
@@ -122,6 +122,8 @@ resolve_references :: proc(
} else {
return {}, true
}
+ } else if position_context.implicit {
+ return {}, true
} else if position_context.identifier != nil {
ident := position_context.identifier.derived.(^ast.Ident)
@@ -165,8 +167,8 @@ resolve_references :: proc(
}
p := parser.Parser {
- err = log_error_handler,
- warn = log_warning_handler,
+ err = log_error_handler,
+ warn = log_warning_handler,
flags = {.Optional_Semicolons},
}
diff --git a/src/server/rename.odin b/src/server/rename.odin
index d50214f..b936d40 100644
--- a/src/server/rename.odin
+++ b/src/server/rename.odin
@@ -1,10 +1,10 @@
package server
-import "shared:common"
+import "src:common"
import "core:log"
-import "core:odin/ast"
import "core:mem"
+import "core:odin/ast"
import "core:runtime"
import "core:strings"
@@ -73,9 +73,8 @@ get_rename :: proc(
*/
if edits = &document_edits[location.uri]; edits == nil {
- document_edits[
- strings.clone(location.uri, context.temp_allocator) \
- ] = make([dynamic]TextEdit, context.temp_allocator)
+ document_edits[strings.clone(location.uri, context.temp_allocator)] =
+ make([dynamic]TextEdit, context.temp_allocator)
edits = &document_edits[location.uri]
}
@@ -89,7 +88,7 @@ get_rename :: proc(
for k, v in document_edits {
append(
&document_changes,
- TextDocumentEdit{
+ TextDocumentEdit {
edits = v[:],
textDocument = {uri = k, version = document.version},
},
diff --git a/src/server/requests.odin b/src/server/requests.odin
index cc03cf5..a877c69 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -17,7 +17,7 @@ import "core:sync"
import "core:thread"
import "core:time"
-import "shared:common"
+import "src:common"
import "base:runtime"
@@ -585,6 +585,17 @@ read_ols_initialize_options :: proc(
allocator = context.allocator,
)
}
+
+ if "shared" not_in config.collections && odin_core_env != "" {
+ forward_path, _ := filepath.to_slash(
+ odin_core_env,
+ context.temp_allocator,
+ )
+ config.collections[strings.clone("shared")] = path.join(
+ elems = {forward_path, "shared"},
+ allocator = context.allocator,
+ )
+ }
}
request_initialize :: proc(
@@ -1172,7 +1183,10 @@ notification_did_save :: proc(
if len(config.profile.checker_path) > 0 {
check(config.profile.checker_path[:], writer, config)
} else {
- if uri, ok := common.parse_uri(config.workspace_folders[0].uri, context.temp_allocator); ok {
+ if uri, ok := common.parse_uri(
+ config.workspace_folders[0].uri,
+ context.temp_allocator,
+ ); ok {
check({uri.path}, writer, config)
}
}
diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin
index e5cbbb1..a6872c7 100644
--- a/src/server/semantic_tokens.odin
+++ b/src/server/semantic_tokens.odin
@@ -5,7 +5,7 @@ import "core:log"
import "core:odin/ast"
import "core:odin/tokenizer"
-import "shared:common"
+import "src:common"
/*
diff --git a/src/server/signature.odin b/src/server/signature.odin
index 1273f5b..fe1c784 100644
--- a/src/server/signature.odin
+++ b/src/server/signature.odin
@@ -1,19 +1,19 @@
package server
-import "core:odin/parser"
-import "core:odin/ast"
-import "core:odin/tokenizer"
import "core:fmt"
import "core:log"
-import "core:strings"
-import path "core:path/slashpath"
import "core:mem"
-import "core:strconv"
+import "core:odin/ast"
+import "core:odin/parser"
+import "core:odin/tokenizer"
import "core:path/filepath"
-import "core:sort"
+import path "core:path/slashpath"
import "core:slice"
+import "core:sort"
+import "core:strconv"
+import "core:strings"
-import "shared:common"
+import "src:common"
SignatureInformationCapabilities :: struct {
parameterInformation: ParameterInformationCapabilities,
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index 57d3946..10750a8 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -11,7 +11,7 @@ import path "core:path/slashpath"
import "core:slice"
import "core:strings"
-import "shared:common"
+import "src:common"
SymbolAndNode :: struct {
symbol: Symbol,
diff --git a/src/server/types.odin b/src/server/types.odin
index 24c5827..1b2bd99 100644
--- a/src/server/types.odin
+++ b/src/server/types.odin
@@ -2,7 +2,7 @@ package server
import "core:encoding/json"
-import "shared:common"
+import "src:common"
/*
General types
diff --git a/src/server/workspace_symbols.odin b/src/server/workspace_symbols.odin
index abc6837..0ce8be1 100644
--- a/src/server/workspace_symbols.odin
+++ b/src/server/workspace_symbols.odin
@@ -1,12 +1,12 @@
package server
-import "core:path/filepath"
-import "core:os"
-import "core:log"
import "core:fmt"
+import "core:log"
+import "core:os"
+import "core:path/filepath"
-import "shared:common"
+import "src:common"
@(private)
walk_dir :: 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,
},
diff --git a/src/testing/testing.odin b/src/testing/testing.odin
index bdd1e16..9f67ff0 100644
--- a/src/testing/testing.odin
+++ b/src/testing/testing.odin
@@ -1,15 +1,15 @@
package ols_testing
-import "core:testing"
-import "core:mem"
import "core:fmt"
-import "core:strings"
-import "core:path/filepath"
-import "core:odin/parser"
+import "core:mem"
import "core:odin/ast"
+import "core:odin/parser"
+import "core:path/filepath"
+import "core:strings"
+import "core:testing"
-import "shared:server"
-import "shared:common"
+import "src:common"
+import "src:server"
Package :: struct {
pkg: string,
@@ -92,8 +92,8 @@ setup :: proc(src: ^Source) {
fullpath := uri.path
p := parser.Parser {
- err = parser.default_error_handler,
- warn = parser.default_error_handler,
+ err = parser.default_error_handler,
+ warn = parser.default_error_handler,
flags = {.Optional_Semicolons},
}
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index e5a9460..0330137 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -3,12 +3,12 @@ package tests
import "core:fmt"
import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_simple_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -35,7 +35,7 @@ ast_simple_struct_completion :: proc(t: ^testing.T) {
@(test)
ast_index_array_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -62,7 +62,7 @@ ast_index_array_completion :: proc(t: ^testing.T) {
@(test)
ast_index_dynamic_array_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -89,7 +89,7 @@ ast_index_dynamic_array_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_pointer_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -116,7 +116,7 @@ ast_struct_pointer_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_take_address_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -144,7 +144,7 @@ ast_struct_take_address_completion :: proc(t: ^testing.T) {
@(test)
ast_struct_deref_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -172,7 +172,7 @@ ast_struct_deref_completion :: proc(t: ^testing.T) {
@(test)
ast_range_map :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -203,7 +203,7 @@ ast_range_map :: proc(t: ^testing.T) {
@(test)
ast_range_array :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -235,7 +235,7 @@ ast_range_array :: proc(t: ^testing.T) {
ast_completion_identifier_proc_group :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -268,7 +268,7 @@ ast_completion_identifier_proc_group :: proc(t: ^testing.T) {
@(test)
ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
@@ -291,7 +291,7 @@ ast_completion_in_comp_lit_type :: proc(t: ^testing.T) {
ast_completion_range_struct_selector_strings :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
array: []string,
@@ -314,7 +314,7 @@ ast_completion_range_struct_selector_strings :: proc(t: ^testing.T) {
@(test)
ast_completion_selector_on_indexed_array :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Foo :: struct {
a: int,
@@ -388,7 +388,7 @@ import "core:odin/parser"
ast_generic_make_slice :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
Allocator :: struct {
}
@@ -422,7 +422,7 @@ ast_generic_make_slice :: proc(t: ^testing.T) {
ast_named_procedure_1 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
proc_a :: proc(a: int, b: int) -> int {
}
@@ -445,7 +445,7 @@ ast_named_procedure_1 :: proc(t: ^testing.T) {
@(test)
ast_named_procedure_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
proc_a :: proc(a: int, b: int) -> int {
}
@@ -468,7 +468,7 @@ ast_named_procedure_2 :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4] f32;
my_array.{*}
@@ -497,7 +497,7 @@ ast_swizzle_completion :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion_one_component :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4] f32;
my_array.x{*}
@@ -517,7 +517,7 @@ ast_swizzle_completion_one_component :: proc(t: ^testing.T) {
@(test)
ast_swizzle_completion_few_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [2] f32;
my_array.x{*}
@@ -538,7 +538,7 @@ ast_swizzle_completion_few_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_one_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4]f32;
my_swizzle := my_array.x;
@@ -554,7 +554,7 @@ ast_swizzle_resolve_one_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_two_components :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
my_array: [4]f32;
my_swizzle := my_array.xx;
@@ -570,7 +570,7 @@ ast_swizzle_resolve_two_components :: proc(t: ^testing.T) {
@(test)
ast_swizzle_resolve_one_component_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
two: int,
@@ -632,7 +632,7 @@ ast_for_in_for_from_different_package :: proc(t: ^testing.T) {
@(test)
ast_for_in_identifier_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
one: int,
two: int,
@@ -664,7 +664,7 @@ ast_for_in_identifier_completion :: proc(t: ^testing.T) {
@(test)
ast_completion_poly_struct_proc :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
RenderPass :: struct(type : typeid) { list : ^int, data : type, }
LightingAccumPass2 :: struct {
@@ -684,7 +684,7 @@ ast_completion_poly_struct_proc :: proc(t: ^testing.T) {
@(test)
ast_generic_make_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
make :: proc{
make_dynamic_array,
@@ -723,7 +723,7 @@ ast_generic_make_completion :: proc(t: ^testing.T) {
@(test)
ast_generic_make_completion_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
make :: proc{
make_dynamic_array,
@@ -793,7 +793,7 @@ ast_struct_for_in_switch_stmt_completion :: proc(t: ^testing.T) {
@(test)
ast_overload_with_any_int_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_group :: proc{
with_any_int,
@@ -819,7 +819,7 @@ ast_overload_with_any_int_completion :: proc(t: ^testing.T) {
@(test)
ast_overload_with_any_int_with_poly_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_group :: proc{
with_any_int,
@@ -952,7 +952,7 @@ ast_package_procedure_completion :: proc(t: ^testing.T) {
@(test)
ast_poly_with_comp_lit_empty_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Struct :: struct {
a: int,
@@ -976,7 +976,7 @@ ast_poly_with_comp_lit_empty_completion :: proc(t: ^testing.T) {
@(test)
ast_global_struct_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
Foo :: struct { x: int }
foo := Foo{}
@@ -993,7 +993,7 @@ ast_global_struct_completion :: proc(t: ^testing.T) {
@(test)
ast_global_non_mutable_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
Foo :: struct { x: int }
main :: proc() {
@@ -1009,7 +1009,7 @@ ast_global_non_mutable_completion :: proc(t: ^testing.T) {
@(test)
ast_basic_value_untyped_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
main :: proc() {
xaa := 2
@@ -1025,7 +1025,7 @@ ast_basic_value_untyped_completion :: proc(t: ^testing.T) {
@(test)
ast_basic_value_binary_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package main
+ main = `package main
main :: proc() {
xaa := 2
@@ -1844,7 +1844,7 @@ ast_index_enum_infer_call_expr :: proc(t: ^testing.T) {
@(test)
ast_index_builtin_ODIN_OS :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
when ODIN_OS == .{*}
}
@@ -1858,7 +1858,7 @@ ast_index_builtin_ODIN_OS :: proc(t: ^testing.T) {
@(test)
ast_for_in_range_half_completion_1 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
ints: []int
@@ -1876,7 +1876,7 @@ ast_for_in_range_half_completion_1 :: proc(t: ^testing.T) {
@(test)
ast_for_in_range_half_completion_2 :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
advance_rune_n :: proc(t: ^Tokenizer, n: int) {
for in 0..<n {
advance_rune(n{*})
@@ -1892,7 +1892,7 @@ ast_for_in_range_half_completion_2 :: proc(t: ^testing.T) {
@(test)
ast_for_in_switch_type :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Foo :: struct {
bar: int,
}
@@ -1924,7 +1924,7 @@ ast_for_in_switch_type :: proc(t: ^testing.T) {
@(test)
ast_procedure_in_procedure_non_mutable_completion :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
test :: proc() {
Int :: int
@@ -1942,7 +1942,7 @@ ast_procedure_in_procedure_non_mutable_completion :: proc(t: ^testing.T) {
@(test)
ast_switch_completion_for_maybe_enum :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
Maybe :: union($T: typeid) {T}
My_Enum :: enum {
@@ -2466,7 +2466,6 @@ ast_poly_struct_with_poly :: proc(t: ^testing.T) {
packages = packages[:],
}
-
test.expect_completion_details(t, &source, "", {"test.first: ^Animal"})
}
@@ -2578,7 +2577,7 @@ ast_poly_proc_matrix_whole :: proc(t: ^testing.T) {
packages := make([dynamic]test.Package)
source := test.Source {
- main = `package test
+ main = `package test
@(require_results)
matrix_mul :: proc "contextless" (
diff --git a/tests/definition_test.odin b/tests/definition_test.odin
index 0f6c26f..6f4b982 100644
--- a/tests/definition_test.odin
+++ b/tests/definition_test.odin
@@ -1,11 +1,11 @@
package tests
-import "core:testing"
import "core:fmt"
+import "core:testing"
-import "shared:common"
+import "src:common"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_goto_comp_lit_field :: proc(t: ^testing.T) {
@@ -24,7 +24,7 @@ ast_goto_comp_lit_field :: proc(t: ^testing.T) {
}
location := common.Location {
- range = {
+ range = {
start = {line = 2, character = 12},
end = {line = 2, character = 13},
},
@@ -51,7 +51,7 @@ ast_goto_comp_lit_field_indexed :: proc(t: ^testing.T) {
}
location := common.Location {
- range = {
+ range = {
start = {line = 2, character = 12},
end = {line = 2, character = 13},
},
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 11c05de..1cee1dc 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -3,12 +3,12 @@ package tests
import "core:fmt"
import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_hover_default_intialized_parameter :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_function :: proc(a := false) {
b := a{*};
@@ -24,7 +24,7 @@ ast_hover_default_intialized_parameter :: proc(t: ^testing.T) {
@(test)
ast_hover_default_parameter_enum :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
procedure :: proc(called_from: Expr_Called_Type = .None, options := List_Options{}) {
}
@@ -44,7 +44,7 @@ ast_hover_default_parameter_enum :: proc(t: ^testing.T) {
@(test)
ast_hover_parameter :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc(cool: int) {
cool{*}
@@ -62,7 +62,7 @@ ast_hover_external_package_parameter :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Struct :: struct {
@@ -92,7 +92,7 @@ ast_hover_procedure_package_parameter :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Struct :: struct {
diff --git a/tests/references_test.odin b/tests/references_test.odin
new file mode 100644
index 0000000..25993ab
--- /dev/null
+++ b/tests/references_test.odin
@@ -0,0 +1,4 @@
+package tests
+
+import "core:fmt"
+import "core:testing"
diff --git a/tests/session_test.odin b/tests/session_test.odin
index 6991125..35f2bc6 100644
--- a/tests/session_test.odin
+++ b/tests/session_test.odin
@@ -1,14 +1,14 @@
package tests
+import "core:fmt"
import "core:log"
import "core:mem"
-import "core:fmt"
import "core:os"
import "core:strings"
import src "../src"
-import "shared:server"
+import "src:server"
initialize_request := `
{ "jsonrpc":"2.0",
@@ -333,7 +333,7 @@ main :: proc() {
buffer := TestReadBuffer {
data = transmute([]byte)strings.join(
- {
+ {
make_request(initialize_request),
make_request(shutdown_request),
make_request(exit_notification),
diff --git a/tests/signatures_test.odin b/tests/signatures_test.odin
index b6de667..66b1b01 100644
--- a/tests/signatures_test.odin
+++ b/tests/signatures_test.odin
@@ -1,15 +1,15 @@
package tests
-import "core:testing"
import "core:fmt"
+import "core:testing"
-import test "shared:testing"
+import test "src:testing"
@(test)
ast_declare_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc({*})
`,
packages = {},
@@ -21,7 +21,7 @@ ast_declare_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_naked_parens :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
if node == nil {
@@ -43,7 +43,7 @@ ast_naked_parens :: proc(t: ^testing.T) {
@(test)
ast_simple_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int) {
}
@@ -64,7 +64,7 @@ ast_simple_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_default_assignment_proc_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b := context.allocator) {
}
@@ -85,7 +85,7 @@ ast_default_assignment_proc_signature :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_last_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int) {
}
@@ -102,7 +102,7 @@ ast_proc_signature_argument_last_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_first_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int) {
}
@@ -120,7 +120,7 @@ ast_proc_signature_argument_first_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_move_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -137,7 +137,7 @@ ast_proc_signature_argument_move_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_complex :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -154,7 +154,7 @@ ast_proc_signature_argument_complex :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_open_brace_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(a: int, b: int, c: int) {
}
@@ -171,7 +171,7 @@ ast_proc_signature_argument_open_brace_position :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_argument_any_ellipsis_position :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
cool_function :: proc(args: ..any, b := 2) {
}
@@ -188,7 +188,7 @@ ast_proc_signature_argument_any_ellipsis_position :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
int_function :: proc(a: int) {
}
@@ -210,7 +210,7 @@ ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
test.expect_signature_labels(
t,
&source,
- {
+ {
"test.int_function: proc(a: int)",
"test.bool_function: proc(a: bool)",
},
@@ -220,7 +220,7 @@ ast_proc_group_signature_empty_call :: proc(t: ^testing.T) {
@(test)
ast_proc_signature_generic :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:mem"
@@ -237,7 +237,7 @@ ast_proc_signature_generic :: proc(t: ^testing.T) {
test.expect_signature_labels(
t,
&source,
- {
+ {
"test.clone_array: proc(array: $A/[]^$T, allocator: mem.Allocator, unique_strings: ^map[string]string) -> A",
},
)
@@ -246,7 +246,7 @@ ast_proc_signature_generic :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_basic_types :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
int_function :: proc(a: int, b: bool, c: int) {
}
@@ -276,7 +276,7 @@ ast_proc_group_signature_basic_types :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_distinct_basic_types :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -311,7 +311,7 @@ ast_proc_group_signature_distinct_basic_types :: proc(t: ^testing.T) {
@(test)
ast_proc_group_signature_struct :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
My_Int :: distinct int;
@@ -358,7 +358,7 @@ index_simple_signature :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
my_function :: proc(a: int, b := context.allocator) {
@@ -390,7 +390,7 @@ index_simple_signature :: proc(t: ^testing.T) {
@(test)
ast_index_builtin_len_proc :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
main :: proc() {
len({*})
}
@@ -408,7 +408,7 @@ ast_index_builtin_len_proc :: proc(t: ^testing.T) {
@(test)
ast_signature_on_invalid_package :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
main :: proc() {
a := totallyReal.read_cycle_counter({*})
@@ -423,7 +423,7 @@ ast_signature_on_invalid_package :: proc(t: ^testing.T) {
@(test)
ast_signature_variable_pointer :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
My_Fun :: proc(a: int) {
@@ -444,7 +444,7 @@ ast_signature_variable_pointer :: proc(t: ^testing.T) {
@(test)
ast_signature_global_variable_pointer :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
import "core:totallyReal"
My_Fun :: proc(a: int) {
@@ -468,7 +468,7 @@ index_variable_pointer_signature :: proc(t: ^testing.T) {
append(
&packages,
- test.Package{
+ test.Package {
pkg = "my_package",
source = `package my_package
My_Fun :: proc(a: int) {
@@ -500,7 +500,7 @@ index_variable_pointer_signature :: proc(t: ^testing.T) {
@(test)
shared_value_decl_type_signature :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_function :: proc(a, b: int) {
@@ -523,7 +523,7 @@ shared_value_decl_type_signature :: proc(t: ^testing.T) {
@(test)
proc_with_struct_poly :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
U :: struct(N: int, E: typetid) {
t: [N]E,
}
@@ -544,7 +544,7 @@ proc_with_struct_poly :: proc(t: ^testing.T) {
@(test)
proc_signature_move_outside :: proc(t: ^testing.T) {
source := test.Source {
- main = `package test
+ main = `package test
my_cool_function :: proc(aa: int, ba: int, c: int) {
}
diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin
index 2424383..e5ca79b 100644
--- a/tools/odinfmt/main.odin
+++ b/tools/odinfmt/main.odin
@@ -1,16 +1,16 @@
package odinfmt
-import "core:os"
-import "core:odin/tokenizer"
-import "shared:odin/printer"
-import "shared:odin/format"
+import "core:encoding/json"
import "core:fmt"
-import "core:strings"
+import "core:mem"
+import "core:odin/tokenizer"
+import "core:os"
import "core:path/filepath"
+import "core:strings"
import "core:time"
-import "core:mem"
-import "core:encoding/json"
import "flag"
+import "src:odin/format"
+import "src:odin/printer"
Args :: struct {
write: Maybe(bool) `flag:"w" usage:"write the new format to file"`,
diff --git a/tools/odinfmt/snapshot/snapshot.odin b/tools/odinfmt/snapshot/snapshot.odin
index 23ae0b8..8252c40 100644
--- a/tools/odinfmt/snapshot/snapshot.odin
+++ b/tools/odinfmt/snapshot/snapshot.odin
@@ -7,7 +7,7 @@ import "core:strings"
import "core:text/scanner"
import "core:fmt"
-import "shared:odin/format"
+import "src:odin/format"
format_file :: proc(
filepath: string,
diff --git a/tools/odinfmt/tests.bat b/tools/odinfmt/tests.bat
index 1c97c17..12c42d8 100644
--- a/tools/odinfmt/tests.bat
+++ b/tools/odinfmt/tests.bat
@@ -1,4 +1,4 @@
echo off
cd /D "%~dp0"
-odin run tests.odin -file -collection:shared=../../src -out:tests.exe
+odin run tests.odin -file -collection:src=../../src -out:tests.exe
if %errorlevel% neq 0 exit 1 \ No newline at end of file
diff --git a/tools/odinfmt/tests.sh b/tools/odinfmt/tests.sh
index d30d325..3036398 100755
--- a/tools/odinfmt/tests.sh
+++ b/tools/odinfmt/tests.sh
@@ -2,7 +2,7 @@
cd "${0%/*}"
-odin run tests.odin -file -collection:shared=../../src -out:tests.exe
+odin run tests.odin -file -collection:src=../../src -out:tests.exe
if ([ $? -ne 0 ])
then