Skip to content
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

[coc.nvim] Connection to server got closed. Server will not be restarted. #2068

Open
lakiwei opened this issue Oct 28, 2024 · 4 comments
Open
Labels
bug Something isn't working

Comments

@lakiwei
Copy link

lakiwei commented Oct 28, 2024

Zig Version

0.14.0-dev.2032+c563ba6b1

ZLS Version

0.14.0-dev.179+5acc066

Client / Code Editor / Extensions

vim 9.1 with coc

Steps to Reproduce and Observed Behavior

open zig file with vim, show error message:
[coc.nvim] Connection to server got closed. Server will not be restarted.

Expected Behavior

open zig file with vim, no error message:

Relevant log output

[Warn  - 09:52:52] No valid workspaceFolder exists
[Trace - 09:52:52] Sending request 'initialize - (0)'.
Params: {
    "processId": 25648,
    "rootPath": "c:\\Users\\U\\Documents\\develop\\source\\zig\\GAME_20240929T0703Z\\src",
    "rootUri": "file:///c%3A/Users/U/Documents/develop/source/zig/GAME_20240929T0703Z/src",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "undo",
                "normalizesLineEndings": true,
                "changeAnnotationSupport": {
                    "groupsOnLabel": false
                }
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true,
                "relativePatternSupport": true
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "inlayHint": {
                "refreshSupport": true
            },
            "inlineValue": {
                "refreshSupport": true
            },
            "diagnostics": {
                "refreshSupport": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "resolveSupport": {
                    "properties": [
                        "location.range"
                    ]
                }
            },
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "insertReplaceSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "labelDetailsSupport": true,
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    }
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "insertTextMode": 2,
                "completionList": {
                    "itemDefaults": [
                        "commitCharacters",
                        "editRange",
                        "insertTextFormat",
                        "insertTextMode"
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "activeParameterSupport": true,
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "references": {
                "dynamicRegistration": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "honorsChangeAnnotations": false,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true,
                "honorsChangeAnnotations": true,
                "prepareSupportDefaultBehavior": 1
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true,
                "foldingRangeKind": {
                    "valueSet": [
                        "comment",
                        "imports",
                        "region"
                    ]
                },
                "foldingRange": {
                    "collapsedText": false
                }
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "decorator",
                    "operator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false,
                "serverCancelSupport": true,
                "augmentsSyntaxTokens": true
            },
            "inlayHint": {
                "dynamicRegistration": true,
                "resolveSupport": {
                    "properties": [
                        "tooltip",
                        "textEdits",
                        "label.tooltip",
                        "label.location",
                        "label.command"
                    ]
                }
            },
            "inlineValue": {
                "dynamicRegistration": true
            },
            "diagnostic": {
                "dynamicRegistration": true,
                "relatedDocumentSupport": true
            },
            "typeHierarchy": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "7.0.5"
            },
            "positionEncodings": [
                "utf-16"
            ],
            "staleRequestSupport": {
                "cancel": true,
                "retryOnContentModified": [
                    "textDocument/inlayHint",
                    "textDocument/semanticTokens/full",
                    "textDocument/semanticTokens/range",
                    "textDocument/semanticTokens/full/delta"
                ]
            }
        }
    },
    "initializationOptions": {},
    "trace": "verbose",
    "workspaceFolders": null,
    "locale": "zh_CN",
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.82"
    }
}


info  ( main ): Starting ZLS      0.14.0-dev.179+5acc066 @ 'zls'
info  ( main ): Message Tracing:  true
info  ( main ): Log Level:        info
info  ( main ): Log File:         C:\Users\U\AppData\Local\Temp\zls\zls.log
info  (server): Client Info:      coc.nvim-0.0.82
info  (server): Set config option 'builtin_path' to "C:\\Users\\U\\AppData\\Local\\Temp\\zls\\builtin.zig"
info  (server): Set config option 'zig_lib_path' to "C:\\Users\\U\\Documents\\develop\\tools\\zig\\0.14.0\\zig\\lib"
info  (server): Set config option 'zig_exe_path' to "C:\\Users\\U\\Documents\\develop\\tools\\zig\\0.14.0\\zig\\zig.exe"
info  (server): Set config option 'build_runner_path' to "C:\\Users\\U\\AppData\\Local\\Temp\\zls\\build_runner\\4ebeb852873127b5ece4bcd8e405fc28\\build_runner.zig"
info  (server): Set config option 'global_cache_path' to "C:\\Users\\U\\AppData\\Local\\Temp\\zls"
[Trace - 09:52:52] Received response 'initialize - (0)' in 52ms.
Result: {
    "capabilities": {
        "positionEncoding": "utf-16",
        "textDocumentSync": {
            "openClose": true,
            "change": 2,
            "willSave": true,
            "willSaveWaitUntil": true,
            "save": true
        },
        "completionProvider": {
            "triggerCharacters": [
                ".",
                ":",
                "@",
                "]",
                "/"
            ],
            "resolveProvider": false,
            "completionItem": {
                "labelDetailsSupport": true
            }
        },
        "hoverProvider": true,
        "signatureHelpProvider": {
            "triggerCharacters": [
                "("
            ],
            "retriggerCharacters": [
                ","
            ]
        },
        "declarationProvider": true,
        "definitionProvider": true,
        "typeDefinitionProvider": true,
        "implementationProvider": false,
        "referencesProvider": true,
        "documentHighlightProvider": true,
        "documentSymbolProvider": true,
        "codeActionProvider": true,
        "colorProvider": false,
        "workspaceSymbolProvider": false,
        "documentFormattingProvider": true,
        "documentRangeFormattingProvider": false,
        "renameProvider": true,
        "foldingRangeProvider": true,
        "selectionRangeProvider": true,
        "semanticTokensProvider": {
            "legend": {
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "operator",
                    "decorator",
                    "errorTag",
                    "builtin",
                    "label",
                    "keywordLiteral"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary",
                    "generic",
                    "_"
                ]
            },
            "range": true,
            "full": true
        },
        "inlayHintProvider": true,
        "workspace": {
            "workspaceFolders": {
                "supported": true,
                "changeNotifications": true
            }
        }
    },
    "serverInfo": {
        "name": "zls",
        "version": "0.14.0-dev.179+5acc066"
    }
}


[Trace - 09:52:52] Sending notification 'initialized'.
Params: {}


[Trace - 09:52:52] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": {}
}


[Trace - 09:52:52] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///c/Users/U/Documents/develop/source/zig/GAME_20240929T0703Z/src/main.zig",
        "languageId": "zig",
        "version": 1,
        "text": "const std = @import(\"std\");\n\npub fn main() anyerror!void {\n    std.debug.print(\"{?}\", .{0});\n}\n"
    }
}


[Trace - 09:52:52] Received request 'client/registerCapability - (register-workspace/didChangeConfiguration)'.
Params: {
    "registrations": [
        {
            "id": "register-workspace/didChangeConfiguration",
            "method": "workspace/didChangeConfiguration"
        }
    ]
}


[Trace - 09:52:52] Sending response 'client/registerCapability - (register-workspace/didChangeConfiguration)'. Processing request took 1ms
No result returned.


[Trace - 09:52:52] Received request 'workspace/configuration - (i_haz_configuration)'.
Params: {
    "items": [
        {
            "section": "zls.enable_snippets"
        },
        {
            "section": "zls.enable_argument_placeholders"
        },
        {
            "section": "zls.enable_build_on_save"
        },
        {
            "section": "zls.build_on_save_args"
        },
        {
            "section": "zls.enable_autofix"
        },
        {
            "section": "zls.semantic_tokens"
        },
        {
            "section": "zls.inlay_hints_show_variable_type_hints"
        },
        {
            "section": "zls.inlay_hints_show_struct_literal_field_type"
        },
        {
            "section": "zls.inlay_hints_show_parameter_name"
        },
        {
            "section": "zls.inlay_hints_show_builtin"
        },
        {
            "section": "zls.inlay_hints_exclude_single_argument"
        },
        {
            "section": "zls.inlay_hints_hide_redundant_param_names"
        },
        {
            "section": "zls.inlay_hints_hide_redundant_param_names_last_token"
        },
        {
            "section": "zls.warn_style"
        },
        {
            "section": "zls.highlight_global_var_declarations"
        },
        {
            "section": "zls.skip_std_references"
        },
        {
            "section": "zls.prefer_ast_check_as_child_process"
        },
        {
            "section": "zls.builtin_path"
        },
        {
            "section": "zls.zig_lib_path"
        },
        {
            "section": "zls.zig_exe_path"
        },
        {
            "section": "zls.build_runner_path"
        },
        {
            "section": "zls.global_cache_path"
        },
        {
            "section": "zls.completion_label_details"
        }
    ]
}


[Trace - 09:52:52] Sending response 'workspace/configuration - (i_haz_configuration)'. Processing request took 1ms
Result: [
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null
]


thread 24640 panic: reached unreachable code
[Trace - 09:52:52] Received request 'workspace/semanticTokens/refresh - (semantic_tokens_refresh)'.
[Trace - 09:52:52] Sending response 'workspace/semanticTokens/refresh - (semantic_tokens_refresh)'. Processing request took 1ms
No result returned.


/home/runner/work/zls/zls/src/DocumentStore.zig:1226:50: 0x7ff77aee44ac in createAndStoreDocument (zls.exe.obj)
/home/runner/work/zls/zls/src/Server.zig:1957:76: 0x7ff77ae19ecd in processMessage (zls.exe.obj)
/home/runner/work/zls/zls/src/Server.zig:2003:62: 0x7ff77add6411 in processJob (zls.exe.obj)
/home/runner/work/zls/zls/src/Server.zig:1826:38: 0x7ff77add5d0f in loop (zls.exe.obj)
/opt/hostedtoolcache/zig/0.14.0-dev.1991/x64/lib/std/start.zig:437:53: 0x7ff77ade15bb in WinStartup (zls.exe.obj)
???:?:?: 0x7ffe63e5257c in ??? (KERNEL32.DLL)
???:?:?: 0x7ffe6580af07 in ??? (ntdll.dll)
[Info  - 09:52:52] Connection to server got closed. Server will restart.
[Error - 09:52:52] zls exited with code: 3
@lakiwei lakiwei added the bug Something isn't working label Oct 28, 2024
@Techatrix
Copy link
Member

Are you able to reproduce the crash somehow or does it happen randomly? I believe that the message trace doesn't show the last request that has been send to ZLS. Could you try and add "args": ["--enable-message-tracing", "--log-level", "debug"], to your coc-settings.json (and remove "trace.server": "verbose", if set)?

I also can't really tell where the unreachable code has been hit in DocumentStore.zig:1226. Trying a debug build of ZLS can provide a more detailed stack trace.

@lakiwei
Copy link
Author

lakiwei commented Nov 7, 2024

Are you able to reproduce the crash somehow or does it happen randomly? I believe that the message trace doesn't show the last request that has been send to ZLS. Could you try and add "args": ["--enable-message-tracing", "--log-level", "debug"], to your coc-settings.json (and remove "trace.server": "verbose", if set)?

I also can't really tell where the unreachable code has been hit in DocumentStore.zig:1226. Trying a debug build of ZLS can provide a more detailed stack trace.

Yes, I can reproduce the crash everytime, I trid add args and got log, If this log still does not help identify the issue, I will try to build a debug version of zls to assist with troubleshooting.:

info  ( main ): Starting ZLS      0.14.0-dev.179+5acc066 @ 'zls'
info  ( main ): Message Tracing:  true
info  ( main ): Log Level:        debug
info  ( main ): Log File:         C:\Users\...\zls.log
debug (message): received: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8832,"rootPath":"c:\\Users\\...\\test","rootUri":"file:///c%3A/.../test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"undo","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":false}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"semanticTokens":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"inlineValue":{"refreshSupport":true},"diagnostics":{"refreshSupport":true},"symb...info  (server): Client Info:      coc.nvim-0.0.82
debug (server): Offset Encoding:  utf-16
info  (server): Set config option 'builtin_path' to "C:\\Users\\...\\zls\\builtin.zig"
info  (server): Set config option 'zig_lib_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\lib"
info  (server): Set config option 'zig_exe_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\zig.exe"
info  (server): Set config option 'build_runner_path' to "C:\\Users\\...\\zls\\build_runner\\4ebeb852873127b5ece4bcd8e405fc28\\build_runner.zig"
info  (server): Set config option 'global_cache_path' to "C:\\Users\\...\\zls"
debug (message): sent: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-16","textDocumentSync":{"openClose":true,"change":2,"willSave":true,"willSaveWaitUntil":true,"save":true},"completionProvider":{"triggerCharacters":[".",":","@","]","/"],"resolveProvider":false,"completionItem":{"labelDetailsSupport":true}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","]},"declarationProvider":true,"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":false,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"colorProvider":false,"workspaceSymbolProvider":false,"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","...debug (server): Took 50ms to process request-0-initialize on Thread 20812
debug (message): received: {"jsonrpc":"2.0","method":"initialized","params":{}}
debug (server): Dynamically registering method 'workspace/didChangeConfiguration'
debug (message): sent: {"jsonrpc":"2.0","id":"register-workspace/didChangeConfiguration","method":"client/registerCapability","params":{"registrations":[{"id":"register-workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}}
debug (message): sent: {"jsonrpc":"2.0","id":"i_haz_configuration","method":"workspace/configuration","params":{"items":[{"section":"zls.enable_snippets"},{"section":"zls.enable_argument_placeholders"},{"section":"zls.enable_build_on_save"},{"section":"zls.build_on_save_args"},{"section":"zls.enable_autofix"},{"section":"zls.semantic_tokens"},{"section":"zls.inlay_hints_show_variable_type_hints"},{"section":"zls.inlay_hints_show_struct_literal_field_type"},{"section":"zls.inlay_hints_show_parameter_name"},{"section":"zls.inlay_hints_show_builtin"},{"section":"zls.inlay_hints_exclude_single_argument"},{"section":"zls.inlay_hints_hide_redundant_param_names"},{"section":"zls.inlay_hints_hide_redundant_param_names_last_token"},{"section":"zls.warn_style"},{"section":"zls.highlight_global_var_declarations"},{"section":"zls.skip_std_references"},{"section":"zls.prefer_ast_check_as_child_process"},{"section":"zls.builtin_path"},{"section":"zls.zig_lib_path"},{"section":"zls.zig_exe_path"},{"section":"zls.build_ru...debug (server): Took 0ms to process notification-initialized on Thread 20812
debug (message): received: {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
debug (message): sent: {"jsonrpc":"2.0","id":"semantic_tokens_refresh","method":"workspace/semanticTokens/refresh"}
debug (server): Took 14ms to process notification-workspace/didChangeConfiguration on Thread 20812
debug (message): received: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c/.../test/main.zig","languageId":"zig","version":1,"text":"\nconst std = @import(\"std\");\n\npub fn main() void {\n    std.debug.print(\"hello {s}.\\n\", .{\"world\"});\n}\n\n"}}}
info  ( main ): Starting ZLS      0.14.0-dev.179+5acc066 @ 'zls'
info  ( main ): Message Tracing:  true
info  ( main ): Log Level:        debug
info  ( main ): Log File:         C:\Users\...\zls.log
debug (message): received: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8832,"rootPath":"c:\\Users\\...\\test","rootUri":"file:///c%3A/.../test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"undo","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":false}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"semanticTokens":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"inlineValue":{"refreshSupport":true},"diagnostics":{"refreshSupport":true},"symb...info  (server): Client Info:      coc.nvim-0.0.82
debug (server): Offset Encoding:  utf-16
info  (server): Set config option 'builtin_path' to "C:\\Users\\...\\zls\\builtin.zig"
info  (server): Set config option 'zig_lib_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\lib"
info  (server): Set config option 'zig_exe_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\zig.exe"
info  (server): Set config option 'build_runner_path' to "C:\\Users\\...\\zls\\build_runner\\4ebeb852873127b5ece4bcd8e405fc28\\build_runner.zig"
info  (server): Set config option 'global_cache_path' to "C:\\Users\\...\\zls"
debug (message): sent: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-16","textDocumentSync":{"openClose":true,"change":2,"willSave":true,"willSaveWaitUntil":true,"save":true},"completionProvider":{"triggerCharacters":[".",":","@","]","/"],"resolveProvider":false,"completionItem":{"labelDetailsSupport":true}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","]},"declarationProvider":true,"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":false,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"colorProvider":false,"workspaceSymbolProvider":false,"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","...debug (server): Took 50ms to process request-0-initialize on Thread 21180
debug (message): received: {"jsonrpc":"2.0","method":"initialized","params":{}}
debug (server): Dynamically registering method 'workspace/didChangeConfiguration'
debug (message): sent: {"jsonrpc":"2.0","id":"register-workspace/didChangeConfiguration","method":"client/registerCapability","params":{"registrations":[{"id":"register-workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}}
debug (message): sent: {"jsonrpc":"2.0","id":"i_haz_configuration","method":"workspace/configuration","params":{"items":[{"section":"zls.enable_snippets"},{"section":"zls.enable_argument_placeholders"},{"section":"zls.enable_build_on_save"},{"section":"zls.build_on_save_args"},{"section":"zls.enable_autofix"},{"section":"zls.semantic_tokens"},{"section":"zls.inlay_hints_show_variable_type_hints"},{"section":"zls.inlay_hints_show_struct_literal_field_type"},{"section":"zls.inlay_hints_show_parameter_name"},{"section":"zls.inlay_hints_show_builtin"},{"section":"zls.inlay_hints_exclude_single_argument"},{"section":"zls.inlay_hints_hide_redundant_param_names"},{"section":"zls.inlay_hints_hide_redundant_param_names_last_token"},{"section":"zls.warn_style"},{"section":"zls.highlight_global_var_declarations"},{"section":"zls.skip_std_references"},{"section":"zls.prefer_ast_check_as_child_process"},{"section":"zls.builtin_path"},{"section":"zls.zig_lib_path"},{"section":"zls.zig_exe_path"},{"section":"zls.build_ru...debug (server): Took 0ms to process notification-initialized on Thread 21180
debug (message): received: {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
debug (message): sent: {"jsonrpc":"2.0","id":"semantic_tokens_refresh","method":"workspace/semanticTokens/refresh"}
debug (server): Took 13ms to process notification-workspace/didChangeConfiguration on Thread 21180
debug (message): received: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c/.../test/main.zig","languageId":"zig","version":1,"text":"\nconst std = @import(\"std\");\n\npub fn main() void {\n    std.debug.print(\"hello {s}.\\n\", .{\"world\"});\n}\n\n"}}}
info  ( main ): Starting ZLS      0.14.0-dev.179+5acc066 @ 'zls'
info  ( main ): Message Tracing:  true
info  ( main ): Log Level:        debug
info  ( main ): Log File:         C:\Users\...\zls.log
debug (message): received: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8832,"rootPath":"c:\\Users\\...\\test","rootUri":"file:///c%3A/.../test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"undo","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":false}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"semanticTokens":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"inlineValue":{"refreshSupport":true},"diagnostics":{"refreshSupport":true},"symb...info  (server): Client Info:      coc.nvim-0.0.82
debug (server): Offset Encoding:  utf-16
info  (server): Set config option 'builtin_path' to "C:\\Users\\...\\zls\\builtin.zig"
info  (server): Set config option 'zig_lib_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\lib"
info  (server): Set config option 'zig_exe_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\zig.exe"
info  (server): Set config option 'build_runner_path' to "C:\\Users\\...\\zls\\build_runner\\4ebeb852873127b5ece4bcd8e405fc28\\build_runner.zig"
info  (server): Set config option 'global_cache_path' to "C:\\Users\\...\\zls"
debug (message): sent: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-16","textDocumentSync":{"openClose":true,"change":2,"willSave":true,"willSaveWaitUntil":true,"save":true},"completionProvider":{"triggerCharacters":[".",":","@","]","/"],"resolveProvider":false,"completionItem":{"labelDetailsSupport":true}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","]},"declarationProvider":true,"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":false,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"colorProvider":false,"workspaceSymbolProvider":false,"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","...debug (server): Took 49ms to process request-0-initialize on Thread 20736
debug (message): received: {"jsonrpc":"2.0","method":"initialized","params":{}}
debug (server): Dynamically registering method 'workspace/didChangeConfiguration'
debug (message): sent: {"jsonrpc":"2.0","id":"register-workspace/didChangeConfiguration","method":"client/registerCapability","params":{"registrations":[{"id":"register-workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}}
debug (message): sent: {"jsonrpc":"2.0","id":"i_haz_configuration","method":"workspace/configuration","params":{"items":[{"section":"zls.enable_snippets"},{"section":"zls.enable_argument_placeholders"},{"section":"zls.enable_build_on_save"},{"section":"zls.build_on_save_args"},{"section":"zls.enable_autofix"},{"section":"zls.semantic_tokens"},{"section":"zls.inlay_hints_show_variable_type_hints"},{"section":"zls.inlay_hints_show_struct_literal_field_type"},{"section":"zls.inlay_hints_show_parameter_name"},{"section":"zls.inlay_hints_show_builtin"},{"section":"zls.inlay_hints_exclude_single_argument"},{"section":"zls.inlay_hints_hide_redundant_param_names"},{"section":"zls.inlay_hints_hide_redundant_param_names_last_token"},{"section":"zls.warn_style"},{"section":"zls.highlight_global_var_declarations"},{"section":"zls.skip_std_references"},{"section":"zls.prefer_ast_check_as_child_process"},{"section":"zls.builtin_path"},{"section":"zls.zig_lib_path"},{"section":"zls.zig_exe_path"},{"section":"zls.build_ru...debug (server): Took 0ms to process notification-initialized on Thread 20736
debug (message): received: {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
debug (message): sent: {"jsonrpc":"2.0","id":"semantic_tokens_refresh","method":"workspace/semanticTokens/refresh"}
debug (server): Took 13ms to process notification-workspace/didChangeConfiguration on Thread 20736
debug (message): received: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c/.../test/main.zig","languageId":"zig","version":1,"text":"\nconst std = @import(\"std\");\n\npub fn main() void {\n    std.debug.print(\"hello {s}.\\n\", .{\"world\"});\n}\n\n"}}}
info  ( main ): Starting ZLS      0.14.0-dev.179+5acc066 @ 'zls'
info  ( main ): Message Tracing:  true
info  ( main ): Log Level:        debug
info  ( main ): Log File:         C:\Users\...\zls.log
debug (message): received: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":8832,"rootPath":"c:\\Users\\...\\test","rootUri":"file:///c%3A/.../test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"undo","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":false}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"semanticTokens":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"inlineValue":{"refreshSupport":true},"diagnostics":{"refreshSupport":true},"symb...info  (server): Client Info:      coc.nvim-0.0.82
debug (server): Offset Encoding:  utf-16
info  (server): Set config option 'builtin_path' to "C:\\Users\\...\\zls\\builtin.zig"
info  (server): Set config option 'zig_lib_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\lib"
info  (server): Set config option 'zig_exe_path' to "C:\\Users\\...\\zig\\0.14.0\\zig\\zig.exe"
info  (server): Set config option 'build_runner_path' to "C:\\Users\\...\\zls\\build_runner\\4ebeb852873127b5ece4bcd8e405fc28\\build_runner.zig"
info  (server): Set config option 'global_cache_path' to "C:\\Users\\...\\zls"
debug (message): sent: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-16","textDocumentSync":{"openClose":true,"change":2,"willSave":true,"willSaveWaitUntil":true,"save":true},"completionProvider":{"triggerCharacters":[".",":","@","]","/"],"resolveProvider":false,"completionItem":{"labelDetailsSupport":true}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","]},"declarationProvider":true,"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":false,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"colorProvider":false,"workspaceSymbolProvider":false,"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","...debug (server): Took 49ms to process request-0-initialize on Thread 18856
debug (message): received: {"jsonrpc":"2.0","method":"initialized","params":{}}
debug (server): Dynamically registering method 'workspace/didChangeConfiguration'
debug (message): sent: {"jsonrpc":"2.0","id":"register-workspace/didChangeConfiguration","method":"client/registerCapability","params":{"registrations":[{"id":"register-workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}}
debug (message): sent: {"jsonrpc":"2.0","id":"i_haz_configuration","method":"workspace/configuration","params":{"items":[{"section":"zls.enable_snippets"},{"section":"zls.enable_argument_placeholders"},{"section":"zls.enable_build_on_save"},{"section":"zls.build_on_save_args"},{"section":"zls.enable_autofix"},{"section":"zls.semantic_tokens"},{"section":"zls.inlay_hints_show_variable_type_hints"},{"section":"zls.inlay_hints_show_struct_literal_field_type"},{"section":"zls.inlay_hints_show_parameter_name"},{"section":"zls.inlay_hints_show_builtin"},{"section":"zls.inlay_hints_exclude_single_argument"},{"section":"zls.inlay_hints_hide_redundant_param_names"},{"section":"zls.inlay_hints_hide_redundant_param_names_last_token"},{"section":"zls.warn_style"},{"section":"zls.highlight_global_var_declarations"},{"section":"zls.skip_std_references"},{"section":"zls.prefer_ast_check_as_child_process"},{"section":"zls.builtin_path"},{"section":"zls.zig_lib_path"},{"section":"zls.zig_exe_path"},{"section":"zls.build_ru...debug (server): Took 0ms to process notification-initialized on Thread 18856
debug (message): received: {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
debug (message): sent: {"jsonrpc":"2.0","id":"semantic_tokens_refresh","method":"workspace/semanticTokens/refresh"}
debug (server): Took 13ms to process notification-workspace/didChangeConfiguration on Thread 18856
debug (message): received: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c/.../test/main.zig","languageId":"zig","version":1,"text":"\nconst std = @import(\"std\");\n\npub fn main() void {\n    std.debug.print(\"hello {s}.\\n\", .{\"world\"});\n}\n\n"}}}

@lakiwei
Copy link
Author

lakiwei commented Nov 13, 2024

I have built the debug version of zls, but the log output is the same as the release version. Do I need a special method to obtain debug information?

@Techatrix
Copy link
Member

The debug build should make a difference when looking at the stack trace when ZLS crashes. Did use :CocCommand workspace.showOutput or the zls.log file? The latter doesn't show panic messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants