Closed tamasfe closed 1 year ago
I also end up with diagnostics shown at wrong locations:
Even though both the syntax tree (and thus the HIR) ranges are correct, the error diagnostic location shown in vscode is way off.
I believe the ranges problem is a systematic one...
Frankly speaking, I can't really see what else would be causing issues other than CRLF and paths... although CRLF seems to be a common one. Tabs are usually troublesome but I don't think we use tabs here.
Changing foo.rhai
to LF makes ALL the problems go away, including the Go-to-References issues.
Now tried it on my own repo, which I have just added a make-shift Rhai.toml
. Here are the logs:
INFO registered request handler method="initialize"
INFO registered request handler method="textDocument/foldingRange"
INFO registered request handler method="textDocument/declaration"
INFO registered request handler method="textDocument/definition"
INFO registered request handler method="textDocument/references"
INFO registered request handler method="textDocument/documentSymbol"
INFO registered request handler method="textDocument/hover"
INFO registered request handler method="textDocument/semanticTokens/full"
INFO registered request handler method="textDocument/completion"
INFO registered request handler method="textDocument/prepareRename"
INFO registered request handler method="textDocument/rename"
INFO registered notification handler method="initialized"
INFO registered notification handler method="textDocument/didOpen"
INFO registered notification handler method="textDocument/didChange"
INFO registered notification handler method="textDocument/didSave"
INFO registered notification handler method="textDocument/didClose"
INFO registered notification handler method="workspace/didChangeConfiguration"
INFO registered notification handler method="workspace/didChangeWorkspaceFolders"
INFO registered notification handler method="workspace/didChangeWatchedFiles"
INFO registered request handler method="rhai/hirDump"
INFO registered request handler method="rhai/syntaxTree"
INFO registered request handler method="rhai/convertOffsets"
INFO created workspace root=root:///
INFO initialize: created workspace root=file:///c%3A/Git/rhai
INFO initialized: found Rhai.toml path="c:\\Git\\rhai\\Rhai.toml"
ERROR initialized: failed to read configuration error=missing field `source` at line 1 column 1
INFO initialized: found files count=35 excluded=0
WARN publish_diagnostics: using detached workspace document_url=file://scripts/array.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/assignment.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/doc-comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/fibonacci.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl4.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/loop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/mat_mul.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/module.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/oop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/primes.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/speed_test.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/string.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/strings_map.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/switch.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/while.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/definitions/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_js/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_main/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_map/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-operators.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-operators.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/array.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/assignment.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/doc-comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/fibonacci.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl4.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/loop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/mat_mul.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/module.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/oop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/primes.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/speed_test.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/string.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/strings_map.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/switch.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/while.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/definitions/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_js/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_main/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_map/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-operators.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-operators.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/array.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/assignment.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/doc-comments.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/fibonacci.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/for3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/function_decl4.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/if2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/loop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/mat_mul.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/module.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/oop.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op1.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op2.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/op3.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/primes.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/speed_test.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/string.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/strings_map.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/switch.rhai
WARN publish_diagnostics: using detached workspace document_url=file://scripts/while.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/definitions/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_js/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_main/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://examples/event_handler_map/script.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://src/api/definitions/builtin-operators.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-functions.d.rhai
WARN publish_diagnostics: using detached workspace document_url=file://target/package/rhai-1.9.0/src/api/definitions/builtin-operators.d.rhai
Not sure if all those using detached workspace document_url
is OK... but Go-to-definitions and Go-to-references do not work. Popups work so they find the definitions OK.
Not sure if all those using detached workspace document_url is OK.
They are not, all file URLs should be absolute in the logs, I thought I fixed this but I'll have another look.
The latest drop fixes these errors. It now works reasonably well.
I'll continue testing.
I think I would close this for the time being, as it seems most of the Windows-specific issues have disappeared...
There seem to be weird issues going on under windows.
Expected behaviour:
https://user-images.githubusercontent.com/25967296/187083450-bd4b3065-3105-40a2-b57b-53a6e3fdd3c1.mp4
Meanwhile in a windows 10 vm:
https://user-images.githubusercontent.com/25967296/187083426-f5c0512d-29cf-4976-b847-c9c2ec73fd1a.mp4
Things I know are platform specific that can cause issues: