From fc1ef5bf57b66c4198016dfb804906e573fb663d Mon Sep 17 00:00:00 2001 From: undisputed goose Date: Wed, 18 May 2022 10:47:25 +0700 Subject: change deprecated -opt flag to -o:speed in linux build --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 484d13c..f09b75e 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [[ $1 == "CI" ]] -then +then ODIN="Odin/odin" else ODIN="odin" @@ -40,4 +40,4 @@ then cd .. fi -${ODIN} build src/ -show-timings -collection:shared=src -out:ols -opt:2 +${ODIN} build src/ -show-timings -collection:shared=src -out:ols -o:speed -- cgit v1.2.3 From c052c9b0763cb57cc57beef2253415ebad064c5e Mon Sep 17 00:00:00 2001 From: Vitalii Kravchenko Date: Sun, 5 Jun 2022 00:29:29 +0100 Subject: Add support for or_else and or_return keywords --- editors/vscode/syntaxes/odin.tmLanguage.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editors/vscode/syntaxes/odin.tmLanguage.json b/editors/vscode/syntaxes/odin.tmLanguage.json index 026aa15..d155e2d 100644 --- a/editors/vscode/syntaxes/odin.tmLanguage.json +++ b/editors/vscode/syntaxes/odin.tmLanguage.json @@ -50,7 +50,7 @@ { "name": "comment.block.odin", "begin": "/\\*", - "end": "\\*/", + "end": "\\*/", "patterns": [{ "include": "#block-comment" }] @@ -90,7 +90,7 @@ }, { "name": "keyword.control.odin", - "match": "\\b(if|else|when|for|in|defer|switch|return)\\b" + "match": "\\b(if|else|or_else|when|for|in|defer|switch|return|or_return)\\b" }, { "name": "keyword.control.odin", -- cgit v1.2.3 From d1bba8a5852a6fd1501bcd1127fb620343ce5672 Mon Sep 17 00:00:00 2001 From: Vitalii Kravchenko Date: Sun, 5 Jun 2022 00:29:48 +0100 Subject: Add the `package` script --- editors/vscode/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 661dc2a..57767bb 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -151,6 +151,7 @@ "lint": "eslint src --ext ts", "watch": "tsc -watch -p ./", "pretest": "npm run compile && npm run lint", + "package": "npm run compile && vsce package -o extension.vsix", "test": "node ./out/test/runTest.js" }, "devDependencies": { @@ -165,7 +166,8 @@ "glob": "^7.2.0", "mocha": "^8.4.0", "typescript": "^4.6.2", - "vscode-test": "^1.6.1" + "vscode-test": "^1.6.1", + "vsce": "^2.7.0" }, "dependencies": { "adm-zip": "^0.5.9", -- cgit v1.2.3 From 575e628cb04f2aed450cbdd55a958cffac3fc4d9 Mon Sep 17 00:00:00 2001 From: JamesDSource Date: Wed, 8 Jun 2022 08:37:45 -0700 Subject: Fixed neovim hover issue --- .gitignore | 2 +- src/server/hover.odin | 16 ++++++++-------- src/server/requests.odin | 14 ++++++++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 2a136bc..f458c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ *.exp *.sqlite *.suo - +ols diff --git a/src/server/hover.odin b/src/server/hover.odin index 1fdecd5..5453860 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -44,7 +44,7 @@ write_hover_content :: proc(ast_context: ^AstContext, symbol: Symbol) -> MarkupC } -get_hover_information :: proc(document: ^common.Document, position: common.Position) -> (Hover, bool) { +get_hover_information :: proc(document: ^common.Document, position: common.Position) -> (Hover, bool, bool) { hover := Hover { contents = { kind = "plaintext", @@ -66,7 +66,7 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit if _, ok := common.keyword_map[ident.name]; ok { hover.contents.kind = "plaintext" hover.range = common.get_token_range(position_context.identifier^, ast_context.file.src) - return hover, true + return hover, true, true } } } @@ -93,7 +93,7 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit } hover.contents = write_hover_content(&ast_context, resolved) - return hover, true + return hover, true, true } } } @@ -102,7 +102,7 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit selector, ok = resolve_type_expression(&ast_context, position_context.selector) if !ok { - return hover, true + return hover, false, true } field: string @@ -125,7 +125,7 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit symbol.pkg = selector.name symbol.signature = common.node_to_string(v.types[i]) hover.contents = write_hover_content(&ast_context, symbol) - return hover, true + return hover, true, true } } } @@ -135,7 +135,7 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit ast_context.current_package = selector.pkg if symbol, ok := resolve_type_identifier(&ast_context, ident^); ok { hover.contents = write_hover_content(&ast_context, symbol) - return hover, true + return hover, true, true } } } @@ -158,9 +158,9 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit } hover.contents = write_hover_content(&ast_context, resolved) - return hover, true + return hover, true, true } } - return hover, true + return hover, false, true } diff --git a/src/server/requests.odin b/src/server/requests.odin index 648392e..c3151b8 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -970,15 +970,21 @@ request_hover :: proc (params: json.Value, id: RequestId, config: ^common.Config } hover: Hover - hover, ok = get_hover_information(document, hover_params.position) + valid: bool + hover, valid, ok = get_hover_information(document, hover_params.position) if !ok { return .InternalError } - response := make_response_message(params = hover, id = id) - - send_response(response, writer) + if valid { + response := make_response_message(params = hover, id = id) + send_response(response, writer) + } + else { + response := make_response_message(params = nil, id = id) + send_response(response, writer) + } return .None } -- cgit v1.2.3 From deaa663ecb5b013f10a628a0f91f17772ad3cc8d Mon Sep 17 00:00:00 2001 From: JamesDSource Date: Wed, 8 Jun 2022 09:03:47 -0700 Subject: Reverted .gitignore changes --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f458c3e..2a136bc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ *.exp *.sqlite *.suo -ols + -- cgit v1.2.3 From 1a24f35c3bd943442b2569f93e38da13f2dda2e2 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Wed, 8 Jun 2022 18:22:32 +0200 Subject: Fix test compile error --- src/testing/testing.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testing/testing.odin b/src/testing/testing.odin index a824d87..8864404 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -240,7 +240,7 @@ expect_hover :: proc(t: ^testing.T, src: ^Source, expect_hover_string: string) { setup(src); defer teardown(src); - hover, ok := server.get_hover_information(src.document, src.position); + hover, _, ok := server.get_hover_information(src.document, src.position); if !ok { testing.error(t, "Failed get_hover_information"); @@ -285,4 +285,4 @@ expect_definition_locations :: proc(t: ^testing.T, src: ^Source, expect_location testing.errorf(t, "Expected location %v, but received %v", expect_locations[i], locations); } } -} \ No newline at end of file +} -- cgit v1.2.3