You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get a compilation error, which is expected due to a lack of type annotation on a function with an external JS implementation. However, nothing is shown in editor about the error (i.e., no problems/errors are displayed). Is this a bug in the LSP, or is it expected that the error not be shown?
Steps to reproduce:
Start a new project, gleam new yo
Add a yo_ffi.mjs file:
exportfunctionyo(){return"yo!";}
Add the yo.gleam file
importgleam/io// No LSP error is shown for missing type annotation.@external(javascript,"./yo_ffi.mjs","yo")fnyo(){"yo!"}pubfnmain(){io.println(yo())}
Run with gleam run -- Ok!.
Run with gleam run --target=javascript and get an error:
error: Missing type annotation
┌─ ./src/yo.gleam:4:1
│
4 │ fn yo() {
│ ^^^^^^^
A return annotation is missing from this function.
Functions with external implementations must have type annotations
so we can tell what type of values they accept and return.
However, no error is shown in the code editor.
Gleam version 1.7.0.
OS: Ubuntu 22.04.5 LTS.
VSCode:
Huh, this is weird. I'm not sure how to reproduce this, but I was just playing around in the file adding code with errors below the rest of the stuff in the yo.gleam file, and for a second the missing annotation error appeared in the editor. However, when I built it again, then I restarted the Gleam server, it disappeared again. Not really sure what is going on with that.
Your language server could have been running in Erlang target mode, then there would be no error. Given you're running the CLI with the --target flag and you've not edited the gleam.toml in those steps it seems likely that's not what is set in gleam.toml.
Yeah that was it. I think I must have had the target = "javascript" bit in there at some point, which led to the error actually being shown for a time.
I get a compilation error, which is expected due to a lack of type annotation on a function with an external JS implementation. However, nothing is shown in editor about the error (i.e., no problems/errors are displayed). Is this a bug in the LSP, or is it expected that the error not be shown?
Steps to reproduce:
gleam new yo
yo_ffi.mjs
file:yo.gleam
filegleam run
-- Ok!.gleam run --target=javascript
and get an error:However, no error is shown in the code editor.
Gleam version 1.7.0.
OS: Ubuntu 22.04.5 LTS.
VSCode:
The text was updated successfully, but these errors were encountered: