aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-02-03 12:57:07 +0100
committerDanielGavin <danielgavin5@hotmail.com>2024-02-03 12:57:07 +0100
commit690a94a64c354eac808e07c6077b2f92b8dfcb88 (patch)
tree064c1145045842db1edb1d22afd02b4b66a1d87e
parent7c9bfc7bbfa05cace89efc39c946bd90229dba2d (diff)
parentbb0773ba7ead80b14781095ea39a9a8a83aa6d03 (diff)
Merge branch 'master' into poly
-rw-r--r--.github/workflows/nightly.yml42
-rwxr-xr-xbuild.sh26
-rw-r--r--src/server/completion.odin30
-rw-r--r--src/server/requests.odin17
4 files changed, 101 insertions, 14 deletions
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 8c789a5..8d5a3bd 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -7,6 +7,36 @@ on:
#- cron: 0 20 * * *
jobs:
+ dist-arm64-darwin:
+ runs-on: macos-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v1
+ - name: Download LLVM and setup PATH
+ run: |
+ brew install llvm@14
+ echo "/usr/local/opt/llvm@14/bin" >> $GITHUB_PATH
+ TMP_PATH=$(xcrun --show-sdk-path)/user/include
+ echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
+ - name: Download Odin
+ run: |
+ git clone https://github.com/odin-lang/Odin
+ - name: Build Odin
+ run: |
+ cd Odin
+ make release
+ - name: Build ols
+ run: ./build.sh CI_NO_TESTS -target:darwin_arm64 -extra-linker-flags:"--target=arm64-apple-macos"
+ - name: Move to Dist
+ run: |
+ mkdir dist
+ mv ols dist/ols-arm64-darwin
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: dist-arm64-darwin
+ path: ./dist
+
dist-x86_64-darwin:
runs-on: macos-latest
timeout-minutes: 15
@@ -98,7 +128,7 @@ jobs:
name: publish
runs-on: ubuntu-latest
timeout-minutes: 30
- needs: ['dist-x86_64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-darwin']
+ needs: ['dist-x86_64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-darwin', 'dist-arm64-darwin']
steps:
- name: Install Nodejs
uses: actions/setup-node@v1
@@ -124,14 +154,24 @@ jobs:
with:
name: dist-x86_64-darwin
path: dist
+ - uses: actions/download-artifact@v2
+ with:
+ name: dist-arm64-darwin
+ path: dist
- run: |
ls -al ./dist
cd dist
zip -r ols-x86_64-pc-windows-msvc.zip ols-x86_64-pc-windows-msvc.exe builtin
+
chmod +x ols-x86_64-unknown-linux-gnu
zip -r ols-x86_64-unknown-linux-gnu.zip ols-x86_64-unknown-linux-gnu builtin
+
chmod +x ols-x86_64-darwin
zip -r ols-x86_64-darwin.zip ols-x86_64-darwin builtin
+
+ chmod +x ols-arm64-darwin
+ zip -r ols-arm64-darwin.zip ols-arm64-darwin builtin
+
rm -rf builtin
- name: Publish Release
uses: ./.github/actions/github-release
diff --git a/build.sh b/build.sh
index 8845ed6..c5e78f5 100755
--- a/build.sh
+++ b/build.sh
@@ -3,11 +3,13 @@
if [[ $1 == "CI" ]]
then
+ shift
+
export PATH=$PATH:$PWD/Odin
#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:shared=../src -o:speed $@
if ([ $? -ne 0 ])
then
@@ -26,12 +28,22 @@ then
#exit 1
fi
fi
+if [[ $1 == "CI_NO_TESTS" ]]
+then
+ shift
+
+ export PATH=$PATH:$PWD/Odin
+fi
if [[ $1 == "single_test" ]]
then
+ shift
+
#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:$2
+ odin test ../tests -collection:shared=../src -test-name:$@
+
+ shift
if ([ $? -ne 0 ])
then
@@ -44,10 +56,12 @@ fi
if [[ $1 == "test" ]]
then
+ shift
+
#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:shared=../src $@
if ([ $? -ne 0 ])
then
@@ -59,9 +73,11 @@ then
fi
if [[ $1 == "debug" ]]
then
- odin build src/ -collection:shared=src -out:ols -use-separate-modules -debug
+ shift
+
+ odin build src/ -collection:shared=src -out:ols -use-separate-modules -debug $@
exit 0
fi
-odin build src/ -collection:shared=src -out:ols -o:speed
+odin build src/ -collection:shared=src -out:ols -o:speed $@
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 36db067..4bb0430 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -675,6 +675,14 @@ get_selector_completion :: proc(
selector,
&items,
)
+ case SymbolSliceValue:
+ list.isIncomplete = false
+ append_magic_dynamic_array_completion(
+ position_context,
+ selector,
+ &items,
+ )
+
case SymbolMapValue:
list.isIncomplete = false
append_magic_map_completion(position_context, selector, &items)
@@ -1732,7 +1740,7 @@ append_magic_map_completion :: proc(
additionalTextEdits := make([]TextEdit, 1, context.temp_allocator)
additionalTextEdits[0] = remove_edit
-
+ symbol_str := get_expression_string_from_position_context(position_context)
//for
{
item := CompletionItem {
@@ -1743,7 +1751,7 @@ append_magic_map_completion :: proc(
textEdit = TextEdit {
newText = fmt.tprintf(
"for ${{1:k}}, ${{2:v}} in %v {{\n\t$0 \n}}",
- symbol.name,
+ symbol_str,
),
range = {start = range.end, end = range.end},
},
@@ -1754,7 +1762,17 @@ append_magic_map_completion :: proc(
append(items, item)
}
}
-
+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]
+ } else if position_context.field != nil {
+ 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 ""
+}
append_magic_dynamic_array_completion :: proc(
position_context: ^DocumentPositionContext,
symbol: Symbol,
@@ -1779,9 +1797,11 @@ append_magic_dynamic_array_completion :: proc(
additionalTextEdits := make([]TextEdit, 1, context.temp_allocator)
additionalTextEdits[0] = remove_edit
+ symbol_str := get_expression_string_from_position_context(position_context)
+
//len
{
- text := fmt.tprintf("len(%v)", symbol.name)
+ text := fmt.tprintf("len(%v)", symbol_str)
item := CompletionItem {
label = "len",
@@ -1807,7 +1827,7 @@ append_magic_dynamic_array_completion :: proc(
textEdit = TextEdit {
newText = fmt.tprintf(
"for i in %v {{\n\t$0 \n}}",
- symbol.name,
+ symbol_str,
),
range = {start = range.end, end = range.end},
},
diff --git a/src/server/requests.odin b/src/server/requests.odin
index cdd2702..4c653ad 100644
--- a/src/server/requests.odin
+++ b/src/server/requests.odin
@@ -10,7 +10,6 @@ import "core:odin/parser"
import "core:os"
import "core:path/filepath"
import path "core:path/slashpath"
-import "core:runtime"
import "core:slice"
import "core:strconv"
import "core:strings"
@@ -20,6 +19,7 @@ import "core:time"
import "shared:common"
+import "base:runtime"
Header :: struct {
content_length: int,
@@ -551,6 +551,17 @@ read_ols_initialize_options :: proc(
allocator = context.allocator,
)
}
+
+ if "base" not_in config.collections && odin_core_env != "" {
+ forward_path, _ := filepath.to_slash(
+ odin_core_env,
+ context.temp_allocator,
+ )
+ config.collections[strings.clone("base")] = path.join(
+ elems = {forward_path, "base"},
+ allocator = context.allocator,
+ )
+ }
}
request_initialize :: proc(
@@ -1077,8 +1088,8 @@ notification_did_save :: proc(
fullpath := uri.path
p := parser.Parser {
- err = log_error_handler,
- warn = log_warning_handler,
+ err = log_error_handler,
+ warn = log_warning_handler,
flags = {.Optional_Semicolons},
}