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

LSP crashes after being started by kakoune-lsp #873

Closed
krobelus opened this issue Aug 4, 2024 · 4 comments
Closed

LSP crashes after being started by kakoune-lsp #873

krobelus opened this issue Aug 4, 2024 · 4 comments

Comments

@krobelus
Copy link

krobelus commented Aug 4, 2024

Describe the bug

Attempting to use templ with the kakoune editor via the kakoune-lsp plugin results in an unintelligible crash.

To Reproduce

  1. Install the Kakoune binary
  2. Install the kakoune-lsp binary
mkdir .config &&
mkdir .config/kak-lsp &&
echo >.config/kak-lsp/kak-lsp.toml '
[language_server.templ]
filetypes = ["templ"]
command = "templ"
roots = [".git", ".hg"]
args = ["lsp"]
' &&
HOME=$PWD kak newfile.templ -e '
set buffer filetype templ
eval %sh{kak-lsp --kakoune -s $kak_session}
set global lsp_cmd "kak-lsp -s %val{session} -vvvv --log /tmp/kakoune-lsp.log"
lsp-enable'

Expected behavior

no crash, possibly completions if I start inputting Go code

Logs

This is the log from kak-lsp
Aug 04 17:19:13.212 INFO Starting main event loop, module: kak_lsp::session:38
Aug 04 17:19:13.213 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_TEMPL, module: kak_lsp::project_root:60
Aug 04 17:19:13.213 INFO Found project root "/home/johannes/git/kakoune-lsp" because it contains ".git", module: kak_lsp::project_root:43
Aug 04 17:19:13.213 DEBG Routing editor request to Route { session: "409262", server_name: "templ", root: "/home/johannes/git/kakoune-lsp" }, module: kak_lsp::session:122
Aug 04 17:19:13.213 DEBG Spawning a new controller for [
    Route {
        session: "409262",
        server_name: "templ",
        root: "/home/johannes/git/kakoune-lsp",
    },
], module: kak_lsp::session:147
Aug 04 17:19:13.214 INFO Starting Language server templ as `templ lsp`, module: kak_lsp::language_server_transport:25
Aug 04 17:19:13.214 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-get-config '/tmp/kakoune-lsp/johannes/fc7d1fe5545d9136', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.216 DEBG lsp_config:
, module: kak_lsp::settings:67
Aug 04 17:19:13.216 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-get-server-initialization-options '/tmp/kakoune-lsp/johannes/56884a6de1224b0e', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.218 DEBG lsp_server_initialization_options:
, module: kak_lsp::settings:100
Aug 04 17:19:13.218 DEBG To server templ: {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"kakoune-lsp","version":"17.1.1-snapshot"},"positionEncodings":["utf-8","utf-16"],"regularExpressions":{"engine":"Rust regex"}},"offsetEncoding":["utf-8","utf-16"],"textDocument":{"callHierarchy":{"dynamicRegistration":false},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.fixAll","source.organizeImports"]}},"dynamicRegistration":false,"isPreferredSupport":false,"resolveSupport":{"properties":["edit"]}},"codeLens":{"dynamicRegistration":false},"colorProvider":{"dynamicRegistration":false},"completion":{"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"preselectSupport":false,"resolveSupport":{"properties":["additionalTextEdits","detail","documentation"]},"snippetSupport":true},"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]},"contextSupport":false,"dynamicRegistration":false},"declaration":{"dynamicRegistration":false,"linkSupport":false},"definition":{"dynamicRegistration":false,"linkSupport":false},"documentHighlight":{"dynamicRegistration":false},"documentLink":{"dynamicRegistration":false,"tooltipSupport":false},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":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]}},"formatting":{"dynamicRegistration":false},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":false},"inlayHint":{"dynamicRegistration":false},"onTypeFormatting":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":true},"rangeFormatting":{"dynamicRegistration":false},"references":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false,"prepareSupport":false},"selectionRange":{},"semanticTokens":{"dynamicRegistration":true,"formats":["relative"],"requests":{"full":true,"range":false},"serverCancelSupport":true,"tokenModifiers":[],"tokenTypes":[]},"signatureHelp":{"contextSupport":false,"dynamicRegistration":false,"signatureInformation":{"documentationFormat":["plaintext"],"parameterInformation":{"labelOffsetSupport":false}}},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":false,"willSaveWaitUntil":false},"typeDefinition":{"dynamicRegistration":false,"linkSupport":false}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"workDoneProgress":true},"workspace":{"applyEdit":true,"codeLens":{},"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false,"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]}},"workspaceEdit":{"changeAnnotationSupport":{},"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","delete","rename"]},"workspaceFolders":true}},"clientInfo":{"name":"kakoune-lsp","version":"17.1.1-snapshot"},"processId":409297,"rootPath":"/home/johannes/git/kakoune-lsp","rootUri":"file:///home/johannes/git/kakoune-lsp","trace":"off","workspaceFolders":[{"name":"/home/johannes/git/kakoune-lsp","uri":"file:///home/johannes/git/kakoune-lsp"}]},"id":0}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.244 DEBG From server templ: {"jsonrpc":"2.0","result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":1,"save":{"includeText":true}},"completionProvider":{"triggerCharacters":[".","{","\u003c"]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":[]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"templ-lsp","version":"v0.2.648"}},"id":0}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.245 DEBG To server templ: {"jsonrpc":"2.0","method":"initialized","params":{}}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.245 ERRO Failed to read file /home/johannes/git/kakoune-lsp/t/empty.templ to simulate textDocument/didOpen: No such file or directory (os error 2), module: kak_lsp::controller:860
Aug 04 17:19:13.245 DEBG lsp_config:
, module: kak_lsp::settings:67
Aug 04 17:19:13.245 DEBG To server templ: {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.245 DEBG From server templ: {"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"5526034947337276102"},"id":1}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.245 DEBG To server templ: {"jsonrpc":"2.0","result":null,"id":1}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.245 DEBG From server templ: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"5526034947337276102","value":{"kind":"begin","message":"Loading packages...","title":"Setting up workspace"}}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.245 DEBG From server templ: {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/johannes/git/kakoune-lsp","section":"gopls"}]},"id":2}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.246 DEBG To server templ: {"jsonrpc":"2.0","result":[null],"id":2}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.246 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- set-option global lsp_progress_indicator ⌛
lsp-handle-progress 5526034947337276102 'Setting up workspace' false 'Loading packages...' '' false, module: kak_lsp::editor_transport:91
Aug 04 17:19:13.254 DEBG From server templ: {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"2024/08/04 19:19:13 Created View (#1)\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tview_type=\"AdHoc\"\n\troot_dir=\"file:///home/johannes/git/kakoune-lsp\"\n\tgo_version=\"go version go1.22.5 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n","type":3}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.255 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-show-message-log templ '2024/08/04 19:19:13 Created View (#1)
	directory=/home/johannes/git/kakoune-lsp
	view_type="AdHoc"
	root_dir="file:///home/johannes/git/kakoune-lsp"
	go_version="go version go1.22.5 linux/amd64"
	build_flags=[]
	env={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64
 ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
	env_overlay=[]
', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.259 DEBG From editor: 
session  = "409262"
buffile  = "/home/johannes/git/kakoune-lsp/t/empty.templ"
filetype = "templ"
version  = 1
method   = "textDocument/didChange"
hook     = true
[params]
draft    = """

"""
, module: kak_lsp::editor_transport:138
Aug 04 17:19:13.259 DEBG From editor: 
session  = "409262"
client   = "client0"
buffile  = "/home/johannes/git/kakoune-lsp/t/empty.templ"
filetype = "templ"
version  = 1
method   = "kakoune/breadcrumbs"
hook = true
[params]
position_line = 1
, module: kak_lsp::editor_transport:138
Aug 04 17:19:13.259 DEBG From editor: 
session  = "409262"
client   = "client0"
buffile  = "/home/johannes/git/kakoune-lsp/t/empty.templ"
filetype = "templ"
version  = 1
method   = "textDocument/codeAction"
hook = true
[params]
selectionDesc    = "1.1,1.1"
performCodeAction = false
autoSingle = false


, module: kak_lsp::editor_transport:138
Aug 04 17:19:13.260 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_TEMPL, module: kak_lsp::project_root:60
Aug 04 17:19:13.260 INFO Found project root "/home/johannes/git/kakoune-lsp" because it contains ".git", module: kak_lsp::project_root:43
Aug 04 17:19:13.260 DEBG Routing editor request to Route { session: "409262", server_name: "templ", root: "/home/johannes/git/kakoune-lsp" }, module: kak_lsp::session:122
Aug 04 17:19:13.260 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_TEMPL, module: kak_lsp::project_root:60
Aug 04 17:19:13.260 DEBG To server templ: {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"templ","text":"\n","uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ","version":1}}}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.260 DEBG To server templ: {"jsonrpc":"2.0","method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ"}},"id":1}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.260 INFO Found project root "/home/johannes/git/kakoune-lsp" because it contains ".git", module: kak_lsp::project_root:43
Aug 04 17:19:13.260 DEBG Routing editor request to Route { session: "409262", server_name: "templ", root: "/home/johannes/git/kakoune-lsp" }, module: kak_lsp::session:122
Aug 04 17:19:13.260 DEBG To server templ: {"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ"}},"id":2}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.260 DEBG Searching for vars starting with KAK_LSP_PROJECT_ROOT_TEMPL, module: kak_lsp::project_root:60
Aug 04 17:19:13.261 DEBG From server templ: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ","diagnostics":[]}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.261 INFO Found project root "/home/johannes/git/kakoune-lsp" because it contains ".git", module: kak_lsp::project_root:43
Aug 04 17:19:13.261 DEBG Routing editor request to Route { session: "409262", server_name: "templ", root: "/home/johannes/git/kakoune-lsp" }, module: kak_lsp::session:122
Aug 04 17:19:13.261 DEBG To server templ: {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":2},"range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ"}},"id":3}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.261 DEBG To editor `409262`: evaluate-commands -buffer '/home/johannes/git/kakoune-lsp/t/empty.templ' %§set-option buffer lsp_diagnostic_error_count 0; set-option buffer lsp_diagnostic_hint_count 0; set-option buffer lsp_diagnostic_info_count 0; set-option buffer lsp_diagnostic_warning_count 0; set-option buffer lsp_inline_diagnostics 1 ; evaluate-commands "set-option buffer lsp_diagnostic_lines 1  '0|%opt[lsp_diagnostic_line_error_sign]'"; set-option buffer lsp_inlay_diagnostics 1 §, module: kak_lsp::editor_transport:95
Aug 04 17:19:13.278 DEBG From server templ: {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"2024/08/04 19:19:13 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tquery=[./ builtin]\n\tpackages=2\n\tduration=23.042177ms\n","type":3}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.278 DEBG From server templ: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"5526034947337276102","value":{"kind":"end","message":"Finished loading packages."}}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.278 DEBG From server templ: {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"gopls"}]},"id":3}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.278 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-show-message-log templ '2024/08/04 19:19:13 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/johannes/git/kakoune-lsp
	query=[./ builtin]
	packages=2
	duration=23.042177ms
', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.278 DEBG To server templ: {"jsonrpc":"2.0","result":[null],"id":3}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.278 DEBG From server templ: {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/johannes/git/kakoune-lsp","section":"gopls"}]},"id":4}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.278 DEBG To server templ: {"jsonrpc":"2.0","result":[null],"id":4}, module: kak_lsp::language_server_transport:199
Aug 04 17:19:13.279 DEBG From server templ: {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"2024/08/04 19:19:13 Created View (#2)\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tview_type=\"AdHoc\"\n\troot_dir=\"file:///home/johannes/git/kakoune-lsp/t\"\n\tgo_version=\"go version go1.22.5 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n","type":3}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.280 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- set-option global lsp_progress_indicator ⌛
lsp-handle-progress 5526034947337276102 'Setting up workspace' false 'Finished loading packages.' 100 true, module: kak_lsp::editor_transport:91
Aug 04 17:19:13.282 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-show-message-log templ '2024/08/04 19:19:13 Created View (#2)
	directory=/home/johannes/git/kakoune-lsp
	view_type="AdHoc"
	root_dir="file:///home/johannes/git/kakoune-lsp/t"
	go_version="go version go1.22.5 linux/amd64"
	build_flags=[]
	env={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64
 ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
	env_overlay=[]
', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.368 DEBG From server templ: {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"2024/08/04 19:19:13 go/packages.Load #2\n\tview_id=\"2\"\n\tsnapshot=0\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tquery=[./ builtin]\n\tpackages=2\n\tduration=88.531512ms\n","type":3}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.368 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-show-message-log templ '2024/08/04 19:19:13 go/packages.Load #2
	view_id="2"
	snapshot=0
	directory=/home/johannes/git/kakoune-lsp
	query=[./ builtin]
	packages=2
	duration=88.531512ms
', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.382 DEBG From server templ: {"jsonrpc":"2.0","result":null,"id":1}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.382 DEBG From server templ: {"jsonrpc":"2.0","result":null,"id":2}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.382 DEBG To editor `409262`: evaluate-commands -buffer '/home/johannes/git/kakoune-lsp/t/empty.templ' %§evaluate-commands "set-option buffer lsp_diagnostic_lines 1  '0|%opt[lsp_diagnostic_line_error_sign]'"
set-option buffer lsp_inlay_code_lenses 1 §, module: kak_lsp::editor_transport:95
Aug 04 17:19:13.383 DEBG From server templ: {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"2024/08/04 19:19:13 imports fixes: allImportsFixes: importPrefix: failed to parse: 7:1: expected 'package', found 'import'\n\tfile=\"/home/johannes/git/kakoune-lsp/t/empty_templ.go\"\n","type":1}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.386 DEBG To editor `409262`: evaluate-commands -client client0 -verbatim -- lsp-show-message-log templ '2024/08/04 19:19:13 imports fixes: allImportsFixes: importPrefix: failed to parse: 7:1: expected ''package'', found ''import''
	file="/home/johannes/git/kakoune-lsp/t/empty_templ.go"
', module: kak_lsp::editor_transport:91
Aug 04 17:19:13.470 DEBG From server templ: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ","version":1,"diagnostics":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"severity":1,"source":"syntax","message":"expected 'package', found 'import'"}]}}, module: kak_lsp::language_server_transport:169
Aug 04 17:19:13.470 DEBG To editor `409262`: evaluate-commands -buffer '/home/johannes/git/kakoune-lsp/t/empty.templ' %§set-option buffer lsp_diagnostic_error_count 1; set-option buffer lsp_diagnostic_hint_count 0; set-option buffer lsp_diagnostic_info_count 0; set-option buffer lsp_diagnostic_warning_count 0; set-option buffer lsp_inline_diagnostics 1 7.1,7.1|DiagnosticError; evaluate-commands "set-option buffer lsp_diagnostic_lines 1 '7|{LineFlagError}%opt[lsp_diagnostic_line_error_sign]' '0|%opt[lsp_diagnostic_line_error_sign]'"; set-option buffer lsp_inlay_diagnostics 1 "7|%opt[lsp_inlay_diagnostic_gap]{InlayDiagnosticError}%opt[lsp_inlay_diagnostic_sign] {InlayDiagnosticError}expected 'package', found 'import'"§, module: kak_lsp::editor_transport:95
Aug 04 17:19:13.472 ERRO Language server stderr: panic: runtime error: invalid memory address or nil pointer dereference, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x81cfa0], module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: , module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: goroutine 24 [running]:, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: github.com/a-h/templ/cmd/templ/lspcmd/proxy.(*Server).CodeAction(0xc00007e0a0, {0xa17090, 0xc0001025f0}, 0xc0000c8d20), module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	github.com/a-h/templ/cmd/templ/lspcmd/proxy/server.go:293 +0x480, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: github.com/a-h/protocol.serverDispatch({0xa17090, 0xc0001025f0}, {0xa1cc20, 0xc00007e0a0}, 0xc00013d8f0, {0xa17368, 0xc0000caf80}), module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/server.go:158 +0x4013, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: github.com/a-h/protocol.NewServer.ServerHandler.func1({0xa17090, 0xc0001025f0}, 0xc00013d8f0, {0xa17368, 0xc0000caf80}), module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	github.com/a-h/protocol@v0.0.0-20230224160810-b4eec67c1c22/server.go:36 +0x7e, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: github.com/a-h/protocol.Handlers.ReplyHandler.func1({0xa17090, 0xc0001025f0}, 0xc0000bb7e8, {0xa17368, 0xc0000caf80}), module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	go.lsp.dev/jsonrpc2@v0.10.0/handler.go:35 +0xc6, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: github.com/a-h/protocol.Handlers.AsyncHandler.func2.2(), module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	go.lsp.dev/jsonrpc2@v0.10.0/handler.go:114 +0x76, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: created by github.com/a-h/protocol.Handlers.AsyncHandler.func2 in goroutine 9, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 ERRO Language server stderr: 	go.lsp.dev/jsonrpc2@v0.10.0/handler.go:112 +0x165, module: kak_lsp::language_server_transport:68
Aug 04 17:19:13.472 DEBG Language server closed pipe, stopping reading, module: kak_lsp::language_server_transport:147
Aug 04 17:19:13.473 INFO Waiting for Messages to language server to finish..., module: kak_lsp::thread_worker:19
Aug 04 17:19:13.473 DEBG Received signal to stop language server, closing pipe, module: kak_lsp::language_server_transport:210
Aug 04 17:19:13.473 DEBG Waiting for language server process end, module: kak_lsp::language_server_transport:103
Aug 04 17:19:14.473 INFO ... Messages to language server terminated with ok, module: kak_lsp::thread_worker:21
Aug 04 17:19:14.473 INFO Waiting for Messages from language server to finish..., module: kak_lsp::thread_worker:19
Aug 04 17:19:14.473 INFO ... Messages from language server terminated with ok, module: kak_lsp::thread_worker:21
Aug 04 17:19:14.473 INFO Waiting for Language server errors to finish..., module: kak_lsp::thread_worker:19
Aug 04 17:19:14.473 INFO ... Language server errors terminated with ok, module: kak_lsp::thread_worker:21
templ log
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:76","msg":"lsp: starting up..."}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:83","msg":"lsp: starting gopls..."}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:96","msg":"creating gopls client"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:101","msg":"creating proxy"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:106","msg":"creating templ server"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"lspcmd/main.go:125","msg":"listening"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:204","msg":"client -> server: Initialize"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:234","msg":"client -> server: Initialize end"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:238","msg":"client -> server: Initialized"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:240","msg":"client -> server: Initialized end"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:569","msg":"client -> server: DidChangeConfiguration"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:571","msg":"client -> server: DidChangeConfiguration end"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:42","msg":"client <- server: WorkDoneProgressCreate"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/08/04 19:26:48 Created View (#1)\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tview_type=\"AdHoc\"\n\troot_dir=\"file:///home/johannes/git/kakoune-lsp\"\n\tgo_version=\"go version go1.22.5 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:602","msg":"client -> server: DidOpen","uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:626","msg":"setting source map cache contents","uri":"file:///home/johannes/git/kakoune-lsp/t/empty.templ"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:633","msg":"client -> server: DidOpen end"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:306","msg":"client -> server: CodeLens"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/08/04 19:26:48 go/packages.Load #1\n\tview_id=\"1\"\n\tsnapshot=0\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tquery=[./ builtin]\n\tpackages=2\n\tduration=9.335964ms\n"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:38","msg":"client <- server: Progress"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:136","msg":"client <- server: Configuration"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/08/04 19:26:48 Created View (#2)\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tview_type=\"AdHoc\"\n\troot_dir=\"file:///home/johannes/git/kakoune-lsp/t\"\n\tgo_version=\"go version go1.22.5 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/johannes/git/kakoune-lsp/.cache/go-build GOMODCACHE:/home/johannes/git/kakoune-lsp/go/pkg/mod GOPATH:/home/johannes/git/kakoune-lsp/go GOPRIVATE: GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.5 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/08/04 19:26:48 go/packages.Load #2\n\tview_id=\"2\"\n\tsnapshot=0\n\tdirectory=/home/johannes/git/kakoune-lsp\n\tquery=[./ builtin]\n\tpackages=2\n\tduration=96.398155ms\n"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:319","msg":"client -> server: CodeLens end"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/server.go:274","msg":"client -> server: CodeAction"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"proxy/client.go:47","msg":"client <- server: LogMessage","message":"2024/08/04 19:26:48 imports fixes: allImportsFixes: importPrefix: failed to parse: 7:1: expected 'package', found 'import'\n\tfile=\"/home/johannes/git/kakoune-lsp/t/empty_templ.go\"\n"}
{"level":"info","ts":"2024-08-04T19:26:48+02:00","caller":"runtime/panic.go:770","msg":"client -> server: CodeAction end"}
$ ./templ info
(✓) os [ goos=linux goarch=amd64 ]
(✓) go [ location=/usr/bin/go version=go version go1.22.5 linux/amd64 ]
(✓) gopls [ location=/usr/bin/gopls version=golang.org/x/tools/gopls (devel) ]
(✗) templ [ location= version= message=templ is not in the path 

Desktop (please complete the following information):

  • OS: Linux
  • templ CLI version: latest
  • Go version (go version go1.22.5 linux/amd64)
  • gopls version (0.16.1)

Additional context

Possible cause is that kakoune-lsp sends

To server templ: {"jsonrpc":"2.0","result":[null],"id":4}

but I don't even get a proper backtrace from templ, so I figured I report it.

@a-h
Copy link
Owner

a-h commented Aug 4, 2024

The code action error from the logs (nil pointer) looks like a bug that was fixed in a previous version of templ - #771

The bug was triggered by a change in behaviour of gopls, so even if templ was working great, as soon as gopls was updated, it would start crashing.

I'd recommend installing the latest version, and making sure it's in your path.

@a-h
Copy link
Owner

a-h commented Aug 4, 2024

Also, you can get templ LSP to log more by adding extra args to the 'templ lsp' command.

@krobelus
Copy link
Author

krobelus commented Aug 5, 2024

thanks it was indeed a PATH problem, I was using an old version.
New version works fine now (now I only need to figure out why htmx-lsp won't give html tag snippet completions)

@krobelus krobelus closed this as completed Aug 5, 2024
@a-h
Copy link
Owner

a-h commented Aug 5, 2024

Great. I'm working (background task, slowly) on getting templ to support proxying down to multiple LSPs so I can improve the HTML LSP support.

Have to balance the work and life etc. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants