-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should distinguish between *.d.rhai
and *.rhai
#77
Comments
Definitions now always have to start with |
Also we could silence the errors by placing a
|
Putting in INFO created workspace root=root:///
INFO LSP server listening transport="stdio"
INFO initialize: created workspace root=file:///c%3A/Git/rhai
INFO initialized: found Rhai.toml path="c:/Git/rhai\\Rhai.toml"
INFO initialized: found files count=39 excluded=0
ERROR initialized: failed to read file error=Access is denied. (os error 5) There is probably an extra backslash... or should it be a forward slash instead? Windows should read forward-slash paths just fine. |
The path should be fine like that, it's something else. The error message is not too helpful. Maybe decreasing the log level could help a bit?
|
DEBUG initialized: found file path="c:/Git/rhai/examples/definitions/.rhai"
ERROR initialized: failed to read file error=Access is denied. (os error 5) |
I see, I did not check whether the path is a directory, whoops. |
Also, I see slightly strange behavior. Firstly, whenever the LSP is run, it successfully finds undeclared variables. However, when I click open that file in the editor, all errors go away: With no definitions, the scope variables I'm sure it did originally, but only until the file is open; then it no longer flag those errors. |
I suspect a panic, what is in the logs? |
Nothing in the logs that show a panic... |
Restarted VScode, and the problem seems to have gone away -- strange, as I restarted before and it persists. Now it correctly flags the undeclared variables. |
There is probably a race condition somewhere in the LSP, I'll look into it. |
Just a hunch. The situation disappeared once I excluded the |
Currently, it seems that files with
.d.rhai
extension are treated the same as Rhai script files instead of LSP definition files.This makes, for example, some Rhai code with definition files come back with parse errors. For example, in the
definitions
API folder:The solution is to treat
*.d.rhai
as definition files automatically.Or require all definition files to have some magic doc comment at the top? For example:
//! @RHAI-DEF-FILE
The text was updated successfully, but these errors were encountered: