-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
Missing Diagnostics #1659
Comments
ZLS does not use Zig to perform code analysis (semantic analysis to be specific). Integrating semantic analysis into ZLS is a large and complex task. Related issues: #551 #552 ziglang/zig#615 There is a relatively new |
I was kinda curious why this error wasn't showing up even with but rather where It looks like any error reported with ❯ zig build -freference-trace ⏎
install
└─ install test_zls
└─ zig build-exe test_zls Debug native 1 errors
/home/lillis/zig/lib/std/fmt.zig:183:13: error: too few arguments
@compileError("too few arguments");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
print__anon_3530: /home/lillis/zig/lib/std/io/Writer.zig:24:26
print: /home/lillis/zig/lib/std/io.zig:324:47
dumpCurrentStackTrace: /home/lillis/zig/lib/std/debug.zig:198:19
unexpectedErrno: /home/lillis/zig/lib/std/posix.zig:7324:18
raise: /home/lillis/zig/lib/std/posix.zig:716:34
abort: /home/lillis/zig/lib/std/posix.zig:684:9
handleSegfaultPosix: /home/lillis/zig/lib/std/debug.zig:2624:10
attachSegfaultHandler: /home/lillis/zig/lib/std/debug.zig:2558:36
maybeEnableSegfaultHandler: /home/lillis/zig/lib/std/debug.zig:2535:18
callMainWithArgs: /home/lillis/zig/lib/std/start.zig:479:14
posixCallMainAndExit: /home/lillis/zig/lib/std/start.zig:438:20
_start: /home/lillis/zig/lib/std/start.zig:351:40
error: the following command failed with 1 compilation errors:
/home/lillis/zig/build/stage3/bin/zig build-exe -freference-trace=256 -ODebug -Mroot=/home/lillis/projects/test_zls/src/main.zig --cache-dir /home/lillis/projects/test_zls/.zig-cache --global-cache-dir /home/lillis/.cache/zig --name test_zls --listen=-
Build Summary: 2/5 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install test_zls transitive failure
└─ zig build-exe test_zls Debug native 1 errors
error: the following build command failed with exit code 1:
/home/lillis/projects/test_zls/.zig-cache/o/169ef625c4b03d73e3a2b14672ed13c1/build /home/lillis/zig/build/stage3/bin/zig /home/lillis/projects/test_zls /home/lillis/projects/test_zls/.zig-cache /home/lillis/.cache/zig --seed 0x5b844879 -Z977f7c67defdb21c -freference-trace Maybe it would be worth looking into how something could be changed upstream to include the actual source location for the error? I'd love to look into this but I'm still pretty useless when it comes tot zig internals. |
I recall having a conversation with someone about this exact issue. I also had the idea of using the reference trace to report a diagnostic at the call-site of |
Zig Version
0.11.0
Zig Language Server Version
0.11.0
Steps to Reproduce
Open a file with the contents:
Note that zls does not emit any warning or error diagnostic describing any problem.
Then, run
zig build
, and note thatzig build
does produce an error describing a problem.Expected Behavior
I would expect that zls can detect compile errors, because zls uses zig to analyze the code.
More precisely, I would expect one of these two cases:
zig build
compiles the codezig build
fails to compile the codeActual Behavior
With
zls
running in my editor, no diagnostic is produced, butzig build
fails to build the code.This is incredibly annoying because it means I have to repeatedly switch between the terminal and the editor, and search for line numbers, instead of being able to just see the problems in my code.
There are many many more reproduction cases where
zig build
is able to find problems thatzls
seems oblivious to.The text was updated successfully, but these errors were encountered: