-
-
Notifications
You must be signed in to change notification settings - Fork 406
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Zig Version
0.16.0-dev.1866+698499215
ZLS Version
Client / Code Editor / Extensions
VSCodium 1.107.1
Steps to Reproduce and Observed Behavior
Open ZLS' .zon file
Type a / on pretty much any line, column 0, ie try to manually comment out a .field
Expected Behavior
Looks like it's not wise to call tree.rootDecls() on a .zon file with no root node
Since this has to do with generating folding ranges for top level imports maybe
diff --git a/src/features/folding_range.zig b/src/features/folding_range.zig
index fb245933..7b15e1e9 100644
--- a/src/features/folding_range.zig
+++ b/src/features/folding_range.zig
@@ -182,7 +182,8 @@ pub fn generateFoldingRanges(allocator: std.mem.Allocator, tree: *const Ast, enc
// TODO add folding range normal comments
// Folding range for top level imports
- {
+ tlis: {
+ if (tree.mode != .zig) break :tlis;
var start_import: ?Ast.Node.Index = null;
var end_import: ?Ast.Node.Index = null;
Log Output
[info] Starting ZLS 0.16.0-dev.82+cbb62284 @ '/home/rad/lab/zls/zig-out/bin/zls'
[info] Log File: /home/rad/.cache/zls/zls.log (debug)
[info] Loaded config: /home/rad/.config/zls.json
[info] Client Info: VSCodium (1.107.1)
[debug] Offset Encoding: 'utf-16'
[info] added Workspace Folder: file:///home/rad/lab/zls
[debug] Dynamically registering method 'workspace/didChangeConfiguration'
[debug] Dynamically registering method 'workspace/didChangeWatchedFiles'
[info] Set config option 'enable_build_on_save' to true
[info] Set config option 'inlay_hints_hide_redundant_param_names' to true
[info] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to true
[info] Set config option 'warn_style' to true
[info] Set config option 'highlight_global_var_declarations' to true
[info] Set config option 'skip_std_references' to true
[info] Set config option 'prefer_ast_check_as_child_process' to false
[info] Set config option 'builtin_path' to "/home/rad/.cache/zls/builtin.zig"
[info] Set config option 'zig_lib_path' to "/home/rad/lab/zig/build/stage4/lib/zig"
[info] Set config option 'zig_exe_path' to "/home/rad/lab/zig/build/stage4/bin/zig"
[info] Set config option 'build_runner_path' to "/home/rad/.cache/zls/build_runner/1840fc2810438c6de9db9b7d586db65b/build_runner.zig"
[info] Set config option 'global_cache_path' to "/home/rad/.cache/zls"
[info] trying to start Build-On-Save for 'file:///home/rad/lab/zls'
[error] thread 101582 panic: invalid enum value
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/debug.zig:121:37: 0x14a58f8 in inactiveUnionField__anon_65888 (std.zig)
[error] @tagName(accessed), @tagName(active),
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/zig/Ast.zig:319:80: 0x1477f5f in rootDecls (std.zig)
[error] .zon => return (&tree.nodes.items(.data)[@intFromEnum(Node.Index.root)].node)[0..1],
[error] ^
[error] /home/rad/lab/zls/src/features/folding_range.zig:189:42: 0x1405c3b in generateFoldingRanges (zls.zig)
[error] const root_decls = tree.rootDecls();
[error] ^
[error] /home/rad/lab/zls/src/Server.zig:1550:51: 0x137a614 in foldingRangeHandler (zls.zig)
[error] return try folding_range.generateFoldingRanges(arena, &handle.tree, server.offset_encoding);
[error] ^
[error] /home/rad/lab/zls/src/Server.zig:1793:72: 0x1324297 in sendRequestSync__anon_44143 (zls.zig)
[error] .@"textDocument/foldingRange" => try server.foldingRangeHandler(arena, params),
[error] ^
[error] /home/rad/lab/zls/src/Server.zig:1842:58: 0x12d1d6b in processMessage (zls.zig)
[error] const result = try server.sendRequestSync(arena, @tagName(method), params);
[error] ^
[error] /home/rad/lab/zls/src/Server.zig:1859:30: 0x12a4b2e in processMessageReportError (zls.zig)
[error] if (server.processMessage(arena_allocator.allocator(), message)) |json_message| {
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/Io.zig:1087:17: 0x12d506f in start (std.zig)
[error] @call(.auto, function, args_casted.*);
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/Io/Threaded.zig:1289:16: 0x11a36a6 in start (std.zig)
[error] gc.func(group, gc.contextPointer());
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/Io/Threaded.zig:777:26: 0x11f4189 in worker (std.zig)
[error] closure.start(closure, t);
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/Thread.zig:558:13: 0x11d1190 in callFn__anon_15757 (std.zig)
[error] @call(.auto, f, args);
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/Thread.zig:1533:30: 0x11a2d00 in entryFn (std.zig)
[error] return callFn(f, self.fn_args);
[error] ^
[error] /home/rad/lab/zig/build/stage4/lib/zig/std/os/linux/x86_64.zig:105:5: 0x11d1245 in clone (std.zig)
[error] asm volatile (
[error] ^Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working