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

published diagnostics are discarded due to file version #1024

Closed
dvic opened this issue Nov 8, 2023 · 7 comments · Fixed by #1036
Closed

published diagnostics are discarded due to file version #1024

dvic opened this issue Nov 8, 2023 · 7 comments · Fixed by #1036
Labels
bug Something isn't working

Comments

@dvic
Copy link

dvic commented Nov 8, 2023

In the Helix editor I'm seeing published diagnostics being discarded because of a version mismatch. I see that there is a todo in the computation of the version:

# TODO store versions on compile/parse/dialyze?
version =
case source_files[uri] do
nil -> nil
file -> file.version
end
Diagnostics.publish_file_diagnostics(
uri,
uri_diagnostics,
Map.get_lazy(source_files, uri, fn -> safely_read_file(SourceFile.Path.from_uri(uri)) end),
version
)

Could this be the reason of the version mismatch in the Helix editor? If so, should we have the option to disable sending the version? (it's optional, right?)

context: helix-editor/helix#8754

@lukaszsamson
Copy link
Collaborator

Version documentation is rather scarce https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#publishDiagnosticsParams

Optional the version number of the document the diagnostics are published for

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_publishDiagnostics the spec does not mention anything about client rejecting diagnostics. I wonder if helix validation isn't too strict. Otherwise race conditions are inherent to diagnostic publish. Code parsing and compilation happens asynchronously and document updates can happen in between start of the parsing and document publish.

Can you post log including textDocument/didChange notifications where update for version x + 1 happens before diagnostic for version x is published? I'd like to be sure there are no obvious bugs on ElixirLS side.

@lukaszsamson
Copy link
Collaborator

Notice that in

ElixirLS pushes diagnostic with current document version and not the version from when the diagnostic was computed. This may not be optimal as the diagnostic may not be relevant to updated document version

@dvic
Copy link
Author

dvic commented Nov 8, 2023

Yeah I think that's what's going wrong, because this PR fixes the issue: https://github.com/helix-editor/helix/pull/8760/files

Let's see what the feedback on that PR will be

@dvic
Copy link
Author

dvic commented Nov 8, 2023

Wow that was fast: helix-editor/helix#8760 (comment)

@dvic
Copy link
Author

dvic commented Nov 8, 2023

Can you post log including textDocument/didChange notifications where update for version x + 1 happens before diagnostic for version x is published? I'd like to be sure there are no obvious bugs on ElixirLS side.

Here is an example session

2023-11-08T22:11:18.505 helix_lsp::transport [ERROR] elixir-ls err <- "Running /Users/dvic/.config/local/share/nvim/mason/packages/elixir-ls/launch.sh\n"
2023-11-08T22:11:18.513 helix_lsp::transport [ERROR] elixir-ls err <- "Preferred shell is zsh, relaunching\n"
2023-11-08T22:11:18.523 helix_lsp::transport [ERROR] elixir-ls err <- "Looking for ASDF install\n"
2023-11-08T22:11:18.523 helix_lsp::transport [ERROR] elixir-ls err <- "ASDF install found in /opt/homebrew/opt/asdf/libexec/asdf.sh, sourcing\n"
2023-11-08T22:11:19.089 helix_lsp::transport [ERROR] elixir-ls err <- "Installing ElixirLS release v0.17.7\n"
2023-11-08T22:11:19.089 helix_lsp::transport [ERROR] elixir-ls err <- "Running in /Users/dvic/Development/pluto/pluto\n"
2023-11-08T22:11:19.297 helix_lsp::transport [ERROR] elixir-ls err <- "Install complete\n"
2023-11-08T22:11:20.123 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.123 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.124 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.139 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.176 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.182 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:20.189 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:21.534 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:21.837 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:23.704 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:24.044 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:24.979 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:35.432 helix_lsp::client [INFO] Using custom LSP config: {"elixirLS":{"dialyzerEnabled":false}}
2023-11-08T22:11:35.432 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (f6021dd0)"},"initializationOptions":{"elixirLS":{"dialyzerEnabled":false}},"processId":56084,"rootPath":"/Users/dvic/Development/pluto/pluto","rootUri":"file:///Users/dvic/Development/pluto/pluto","workspaceFolders":[{"name":"pluto","uri":"file:///Users/dvic/Development/pluto/pluto"}]},"id":0}
2023-11-08T22:11:35.449 helix_lsp::transport [ERROR] elixir-ls err <- "Running /Users/dvic/.config/local/share/nvim/mason/packages/elixir-ls/launch.sh\n"
2023-11-08T22:11:35.455 helix_lsp::transport [ERROR] elixir-ls err <- "Preferred shell is zsh, relaunching\n"
2023-11-08T22:11:35.464 helix_lsp::transport [ERROR] elixir-ls err <- "Looking for ASDF install\n"
2023-11-08T22:11:35.464 helix_lsp::transport [ERROR] elixir-ls err <- "ASDF install found in /opt/homebrew/opt/asdf/libexec/asdf.sh, sourcing\n"
2023-11-08T22:11:36.058 helix_lsp::transport [ERROR] elixir-ls err <- "Installing ElixirLS release v0.17.7\n"
2023-11-08T22:11:36.058 helix_lsp::transport [ERROR] elixir-ls err <- "Running in /Users/dvic/Development/pluto/pluto\n"
2023-11-08T22:11:36.268 helix_lsp::transport [ERROR] elixir-ls err <- "Install complete\n"
2023-11-08T22:11:37.093 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Started ElixirLS v0.17.7","type":3}}
2023-11-08T22:11:37.093 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Running in /Users/dvic/Development/pluto/pluto","type":3}}
2023-11-08T22:11:37.093 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Started ElixirLS v0.17.7" }
2023-11-08T22:11:37.093 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Running in /Users/dvic/Development/pluto/pluto" }
2023-11-08T22:11:37.095 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"ElixirLS built with elixir \"1.15.7\" on OTP \"26\"","type":3}}
2023-11-08T22:11:37.095 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Running on elixir \"1.15.7 (compiled with Erlang/OTP 26)\" on OTP \"26\"","type":3}}
2023-11-08T22:11:37.095 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "ElixirLS built with elixir \"1.15.7\" on OTP \"26\"" }
2023-11-08T22:11:37.095 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Running on elixir \"1.15.7 (compiled with Erlang/OTP 26)\" on OTP \"26\"" }
2023-11-08T22:11:37.096 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Protocols are not consolidated","type":3}}
2023-11-08T22:11:37.096 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Protocols are not consolidated" }
2023-11-08T22:11:37.101 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"eep48","measurements":{},"properties":{"elixir_ls.eep48":"true","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"dev","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:37.101 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.101 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"elixir_sources","measurements":{},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_sources":"true","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"dev","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:37.101 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.101 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"otp_sources","measurements":{},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"dev","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26","elixir_ls.otp_sources":"true"}}}
2023-11-08T22:11:37.101 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.117 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"dialyzer_support","measurements":{},"properties":{"elixir_ls.dialyzer_support":"true","elixir_ls.dialyzer_support_reason":"","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"dev","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:37.117 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls <- {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":false,"codeLensProvider":{"resolveProvider":false},"completionProvider":{"triggerCharacters":[".","@","&","%","^",":","!","-","~"]},"definitionProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n"},"documentSymbolProvider":true,"executeCommandProvider":{"commands":["expandMacro:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","getExUnitTestsInFile:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","manipulatePipes:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","mixClean:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","restart:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","spec:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"macroExpansion":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":{"change":2,"openClose":true,"save":{"includeText":true}},"workspace":{"workspaceFolders":{"changeNotifications":false,"supported":false}},"workspaceSymbolProvider":true},"serverInfo":{"name":"ElixirLS","version":"0.17.7"}}}
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls <- {"capabilities":{"codeActionProvider":false,"codeLensProvider":{"resolveProvider":false},"completionProvider":{"triggerCharacters":[".","@","&","%","^",":","!","-","~"]},"definitionProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n"},"documentSymbolProvider":true,"executeCommandProvider":{"commands":["expandMacro:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","getExUnitTestsInFile:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","manipulatePipes:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","mixClean:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","restart:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5","spec:1OGTvYhdCTkCTaLKk2v9mgxi4ufVEhQ5"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"macroExpansion":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"textDocumentSync":{"change":2,"openClose":true,"save":{"includeText":true}},"workspace":{"workspaceFolders":{"changeNotifications":false,"supported":false}},"workspaceSymbolProvider":true},"serverInfo":{"name":"ElixirLS","version":"0.17.7"}}
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_request","measurements":{"elixir_ls.lsp_request_time":46},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.lsp_command":"initialize","elixir_ls.mix_env":"dev","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"elixirLS":{"dialyzerEnabled":false}}}}
2023-11-08T22:11:37.153 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"elixir","text":"defmodule Pluto.Events.CropType.Added do\n  @moduledoc \"\"\"\n  Emitted when a crop type is added.\n  \"\"\"\n\n  use Pluto.TypedStruct\n\n  typedstruct do\n    field :id, UUID.t()\n    field :name, Text.t()\n    field :aspect_ratio, pos_integer() | float() | :free_mode\n    field :min_size, Pluto.CropType.size(), default: {0, 0}\n    field :mask, atom() | nil\n  end\n\n  def foo do\n    foo + 123\n  end\nend\n\ndefimpl Pluto.Upcast, for: Pluto.Events.CropType.Added do\n  def upcast(%{mask: _} = event), do: event\n  def upcast(event), do: Map.put(event, :mask, nil)\nend\n","uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":0}}}
2023-11-08T22:11:37.153 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.154 helix_lsp::transport [INFO] elixir-ls <- {"id":1,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///Users/dvic/Development/pluto/pluto","section":"elixirLS"}]}}
2023-11-08T22:11:37.154 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","result":[{"dialyzerEnabled":false}],"id":1}
2023-11-08T22:11:37.155 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Received client configuration via workspace/configuration\n%{\"dialyzerEnabled\" => false}","type":3}}
2023-11-08T22:11:37.155 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Received client configuration via workspace/configuration\n%{\"dialyzerEnabled\" => false}" }
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_config","measurements":{},"properties":{"elixir_ls.autoBuild":"true","elixir_ls.autoInsertRequiredAlias":"true","elixir_ls.dialyzerEnabled":"false","elixir_ls.dialyzerFormat":"","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.enableTestLenses":"false","elixir_ls.envVariables":"false","elixir_ls.erts_version":"14.1.1","elixir_ls.fetchDeps":"false","elixir_ls.languageServerOverridePath":"false","elixir_ls.mixEnv":"test","elixir_ls.mixTarget":"host","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26","elixir_ls.projectDir":"false","elixir_ls.signatureAfterComplete":"true","elixir_ls.suggestSpecs":"true"}}}
2023-11-08T22:11:37.160 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Client does not support workspace/didChangeConfiguration dynamic registration","type":3}}
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Starting build with MIX_ENV: test MIX_TARGET: host","type":3}}
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Client does not support workspace/didChangeConfiguration dynamic registration" }
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Registering for workspace/didChangeWatchedFiles notifications","type":3}}
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Starting build with MIX_ENV: test MIX_TARGET: host" }
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Registering for workspace/didChangeWatchedFiles notifications" }
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"id":2,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"607C03C7C86BBBE1F1B24CEC1ACF341C01DE8E52","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.ex"},{"globPattern":"**/*.exs"},{"globPattern":"**/*.erl"},{"globPattern":"**/*.hrl"},{"globPattern":"**/*.yrl"},{"globPattern":"**/*.xrl"},{"globPattern":"**/*.eex"},{"globPattern":"**/*.leex"},{"globPattern":"**/*.heex"},{"globPattern":"**/*.sface"}]}}]}}
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","result":null,"id":2}
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"client/registerCapability succeeded","type":3}}
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "client/registerCapability succeeded" }
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Received workspace/didChangeConfiguration","type":3}}
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Received workspace/didChangeConfiguration" }
2023-11-08T22:11:37.160 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Received client configuration via workspace/didChangeConfiguration\n%{\"dialyzerEnabled\" => false}","type":3}}
2023-11-08T22:11:37.160 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Received client configuration via workspace/didChangeConfiguration\n%{\"dialyzerEnabled\" => false}" }
2023-11-08T22:11:37.169 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_config","measurements":{},"properties":{"elixir_ls.autoBuild":"true","elixir_ls.autoInsertRequiredAlias":"true","elixir_ls.dialyzerEnabled":"false","elixir_ls.dialyzerFormat":"","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.enableTestLenses":"false","elixir_ls.envVariables":"false","elixir_ls.erts_version":"14.1.1","elixir_ls.fetchDeps":"false","elixir_ls.languageServerOverridePath":"false","elixir_ls.mixEnv":"test","elixir_ls.mixTarget":"host","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26","elixir_ls.projectDir":"false","elixir_ls.signatureAfterComplete":"true","elixir_ls.suggestSpecs":"true"}}}
2023-11-08T22:11:37.169 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:37.172 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":0}}
2023-11-08T22:11:37.727 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Loaded DETS databases in 565ms","type":3}}
2023-11-08T22:11:37.727 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Loaded DETS databases in 565ms" }
2023-11-08T22:11:38.601 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Loaded DETS databases in 552ms","type":3}}
2023-11-08T22:11:38.601 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Loaded DETS databases in 552ms" }
2023-11-08T22:11:38.814 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compiling 5 files (.ex)","type":4}}
2023-11-08T22:11:38.814 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Compiling 5 files (.ex)" }
2023-11-08T22:11:38.845 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"error: undefined variable \"foo\"\n  lib/pluto/events/crop_type/added.ex:17: Pluto.Events.CropType.Added.foo/0\n","type":2}}
2023-11-08T22:11:38.845 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Warning, message: "error: undefined variable \"foo\"\n  lib/pluto/events/crop_type/added.ex:17: Pluto.Events.CropType.Added.foo/0\n" }
2023-11-08T22:11:38.848 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"\n== Compilation error in file lib/pluto/events/crop_type/added.ex ==\n** (CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)\n","type":2}}
2023-11-08T22:11:38.848 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Warning, message: "\n== Compilation error in file lib/pluto/events/crop_type/added.ex ==\n** (CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)\n" }
2023-11-08T22:11:38.858 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compile took 1698 milliseconds","type":3}}
2023-11-08T22:11:38.858 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"build","measurements":{"elixir_ls.build_time":1698},"properties":{"elixir_ls.build_result":"mix_compile_error","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:38.858 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Compile took 1698 milliseconds" }
2023-11-08T22:11:38.858 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:38.859 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"(CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"severity":1,"source":"Elixir"},{"message":"undefined variable \"foo\"","range":{"end":{"character":3,"line":16},"start":{"character":3,"line":16}},"severity":1,"source":"Elixir"}],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":0}}
2023-11-08T22:11:38.859 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] Indexing...","type":3}}
2023-11-08T22:11:38.859 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Starting build with MIX_ENV: test MIX_TARGET: host","type":3}}
2023-11-08T22:11:38.859 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] Indexing..." }
2023-11-08T22:11:38.859 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Starting build with MIX_ENV: test MIX_TARGET: host" }
2023-11-08T22:11:38.871 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] Module discovery complete","type":3}}
2023-11-08T22:11:38.871 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] Module discovery complete" }
2023-11-08T22:11:38.928 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 116 callbacks added to index","type":3}}
2023-11-08T22:11:38.928 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 116 callbacks added to index" }
2023-11-08T22:11:39.027 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 447 modules added to index","type":3}}
2023-11-08T22:11:39.027 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 447 modules added to index" }
2023-11-08T22:11:39.229 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 668 types added to index","type":3}}
2023-11-08T22:11:39.229 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 668 types added to index" }
2023-11-08T22:11:40.555 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Stopping pluto","type":4}}
2023-11-08T22:11:40.555 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Unloading pluto","type":4}}
2023-11-08T22:11:40.555 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Stopping pluto" }
2023-11-08T22:11:40.555 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Unloading pluto" }
2023-11-08T22:11:40.680 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 8477 functions added to index","type":3}}
2023-11-08T22:11:40.680 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 8477 functions added to index" }
2023-11-08T22:11:40.808 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compiling 5 files (.ex)","type":4}}
2023-11-08T22:11:40.808 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Compiling 5 files (.ex)" }
2023-11-08T22:11:40.822 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"error: undefined variable \"foo\"\n  lib/pluto/events/crop_type/added.ex:17: Pluto.Events.CropType.Added.foo/0\n","type":2}}
2023-11-08T22:11:40.823 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Warning, message: "error: undefined variable \"foo\"\n  lib/pluto/events/crop_type/added.ex:17: Pluto.Events.CropType.Added.foo/0\n" }
2023-11-08T22:11:40.824 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"\n== Compilation error in file lib/pluto/events/crop_type/added.ex ==\n** (CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)\n","type":2}}
2023-11-08T22:11:40.824 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Warning, message: "\n== Compilation error in file lib/pluto/events/crop_type/added.ex ==\n** (CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)\n" }
2023-11-08T22:11:40.833 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compile took 1973 milliseconds","type":3}}
2023-11-08T22:11:40.833 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"(CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"severity":1,"source":"Elixir"},{"message":"undefined variable \"foo\"","range":{"end":{"character":3,"line":16},"start":{"character":3,"line":16}},"severity":1,"source":"Elixir"}],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":0}}
2023-11-08T22:11:40.833 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"build","measurements":{"elixir_ls.build_time":1973},"properties":{"elixir_ls.build_result":"mix_compile_error","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:40.833 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Compile took 1973 milliseconds" }
2023-11-08T22:11:40.833 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:44.403 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":7,"line":16},"start":{"character":4,"line":16}},"text":""}],"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":1}}}
2023-11-08T22:11:44.415 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed
2023-11-08T22:11:44.426 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/signatureHelp","params":{"position":{"character":4,"line":16},"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex"}},"id":1}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"id":1,"jsonrpc":"2.0","result":{"activeParameter":1,"activeSignature":0,"signatures":[{"documentation":{"kind":"markdown","value":"Defines a public function with the given name and body."},"label":"def(call, expr \\\\ nil)","parameters":[{"label":"call"},{"label":"expr \\\\ nil"}]}]}}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"activeParameter":1,"activeSignature":0,"signatures":[{"documentation":{"kind":"markdown","value":"Defines a public function with the given name and body."},"label":"def(call, expr \\\\ nil)","parameters":[{"label":"call"},{"label":"expr \\\\ nil"}]}]}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_request","measurements":{"elixir_ls.lsp_request_time":40},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.lsp_command":"textDocument_signatureHelp","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:44.467 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:44.706 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"(CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"severity":1,"source":"Elixir"},{"message":"undefined variable \"foo\"","range":{"end":{"character":3,"line":16},"start":{"character":3,"line":16}},"severity":1,"source":"Elixir"}],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":2}}
2023-11-08T22:11:44.710 helix_term::application [INFO] Version (2) is out of date for "/Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex" (expected (1), dropping PublishDiagnostic notification
2023-11-08T22:11:45.613 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":4,"line":16},"start":{"character":4,"line":16}},"text":"1"}],"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":2}}}
2023-11-08T22:11:45.625 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed
2023-11-08T22:11:45.646 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":5,"line":16},"start":{"character":5,"line":16}},"text":"2"}],"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":3}}}
2023-11-08T22:11:45.696 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":6,"line":16},"start":{"character":6,"line":16}},"text":"3"}],"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":4}}}
2023-11-08T22:11:45.998 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"(CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"severity":1,"source":"Elixir"},{"message":"undefined variable \"foo\"","range":{"end":{"character":3,"line":16},"start":{"character":3,"line":16}},"severity":1,"source":"Elixir"}],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":5}}
2023-11-08T22:11:46.000 helix_term::application [INFO] Version (5) is out of date for "/Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex" (expected (4), dropping PublishDiagnostic notification
2023-11-08T22:11:46.446 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/formatting","params":{"options":{"insertSpaces":true,"tabSize":2},"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex"}},"id":2}
2023-11-08T22:11:46.483 helix_lsp::transport [INFO] elixir-ls <- {"id":2,"jsonrpc":"2.0","result":[]}
2023-11-08T22:11:46.483 helix_lsp::transport [INFO] elixir-ls <- []
2023-11-08T22:11:46.483 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_request","measurements":{"elixir_ls.lsp_request_time":37},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.lsp_command":"textDocument_formatting","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:46.484 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:46.484 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didSave","params":{"text":"defmodule Pluto.Events.CropType.Added do\n  @moduledoc \"\"\"\n  Emitted when a crop type is added.\n  \"\"\"\n\n  use Pluto.TypedStruct\n\n  typedstruct do\n    field :id, UUID.t()\n    field :name, Text.t()\n    field :aspect_ratio, pos_integer() | float() | :free_mode\n    field :min_size, Pluto.CropType.size(), default: {0, 0}\n    field :mask, atom() | nil\n  end\n\n  def foo do\n    123 + 123\n  end\nend\n\ndefimpl Pluto.Upcast, for: Pluto.Events.CropType.Added do\n  def upcast(%{mask: _} = event), do: event\n  def upcast(event), do: Map.put(event, :mask, nil)\nend\n","textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex"}}}
2023-11-08T22:11:46.484 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"workspace/didChangeWatchedFiles","params":{"changes":[{"type":2,"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex"}]}}
2023-11-08T22:11:46.484 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Starting build with MIX_ENV: test MIX_TARGET: host","type":3}}
2023-11-08T22:11:46.485 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Starting build with MIX_ENV: test MIX_TARGET: host" }
2023-11-08T22:11:47.169 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Stopping pluto","type":4}}
2023-11-08T22:11:47.169 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Unloading pluto","type":4}}
2023-11-08T22:11:47.169 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Stopping pluto" }
2023-11-08T22:11:47.169 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Unloading pluto" }
2023-11-08T22:11:47.380 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compiling 5 files (.ex)","type":4}}
2023-11-08T22:11:47.380 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "Compiling 5 files (.ex)" }
2023-11-08T22:11:48.012 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Compile took 1527 milliseconds","type":3}}
2023-11-08T22:11:48.012 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":5}}
2023-11-08T22:11:48.012 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"build","measurements":{"elixir_ls.build_time":1527},"properties":{"elixir_ls.build_result":"mix_compile_ok","elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:48.012 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Compile took 1527 milliseconds" }
2023-11-08T22:11:48.012 helix_term::application [INFO] Version (5) is out of date for "/Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex" (expected (4), dropping PublishDiagnostic notification
2023-11-08T22:11:48.012 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:48.012 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] Updating index...","type":3}}
2023-11-08T22:11:48.012 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] Updating index..." }
2023-11-08T22:11:48.023 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 4 modules need reindexing","type":3}}
2023-11-08T22:11:48.023 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 4 modules need reindexing" }
2023-11-08T22:11:48.024 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 0 callbacks added to index","type":3}}
2023-11-08T22:11:48.024 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 0 callbacks added to index" }
2023-11-08T22:11:48.024 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 4 modules added to index","type":3}}
2023-11-08T22:11:48.024 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 4 modules added to index" }
2023-11-08T22:11:48.025 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 1 types added to index","type":3}}
2023-11-08T22:11:48.025 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 1 types added to index" }
2023-11-08T22:11:48.029 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"[ElixirLS WorkspaceSymbols] 25 functions added to index","type":3}}
2023-11-08T22:11:48.029 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "[ElixirLS WorkspaceSymbols] 25 functions added to index" }

I tagged you along in that helix issue by the way, hope you don't mind, I really want to get to the bottom of this 😄

@dvic
Copy link
Author

dvic commented Nov 8, 2023

This does look like a bug on elixirls side, doesn't it? if you look at these lines:

2023-11-08T22:11:44.403 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":7,"line":16},"start":{"character":4,"line":16}},"text":""}],"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":1}}}
2023-11-08T22:11:44.415 helix_vcs::diff::worker [INFO] Diff computation timed out, update of diffs might appear delayed
2023-11-08T22:11:44.426 helix_lsp::transport [INFO] elixir-ls -> {"jsonrpc":"2.0","method":"textDocument/signatureHelp","params":{"position":{"character":4,"line":16},"textDocument":{"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex"}},"id":1}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"id":1,"jsonrpc":"2.0","result":{"activeParameter":1,"activeSignature":0,"signatures":[{"documentation":{"kind":"markdown","value":"Defines a public function with the given name and body."},"label":"def(call, expr \\\\ nil)","parameters":[{"label":"call"},{"label":"expr \\\\ nil"}]}]}}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"activeParameter":1,"activeSignature":0,"signatures":[{"documentation":{"kind":"markdown","value":"Defines a public function with the given name and body."},"label":"def(call, expr \\\\ nil)","parameters":[{"label":"call"},{"label":"expr \\\\ nil"}]}]}
2023-11-08T22:11:44.466 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"telemetry/event","params":{"name":"lsp_request","measurements":{"elixir_ls.lsp_request_time":40},"properties":{"elixir_ls.elixir_release":"1.15","elixir_ls.elixir_version":"1.15.7","elixir_ls.erts_version":"14.1.1","elixir_ls.lsp_command":"textDocument_signatureHelp","elixir_ls.mix_env":"test","elixir_ls.mix_target":"host","elixir_ls.otp_release":"26"}}}
2023-11-08T22:11:44.467 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2023-11-08T22:11:44.706 helix_lsp::transport [INFO] elixir-ls <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"message":"(CompileError) lib/pluto/events/crop_type/added.ex: cannot compile module Pluto.Events.CropType.Added (errors have been logged)","range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"severity":1,"source":"Elixir"},{"message":"undefined variable \"foo\"","range":{"end":{"character":3,"line":16},"start":{"character":3,"line":16}},"severity":1,"source":"Elixir"}],"uri":"file:///Users/dvic/Development/pluto/pluto/lib/pluto/events/crop_type/added.ex","version":2}}

Here the version sent with didChange is 1 but we respond with 2? Shouldn't there always be a corresponding publishDiagnostics?

@lukaszsamson
Copy link
Collaborator

Thanks for detailed report @dvic. This is indeed an ElixirLS issue. The versioning was broken since the original code dump (or it may got broken when support for LSP 3.0 was added ca 2017). We first store the version in

%SourceFile{source_file | version: version, dirty?: true}
and then increment in while the LSP spec states

The version number points to the version after all provided content changes have been applied

This bug started manifesting in v0.17 when we started sending diagnostics with version.

I have a fix ready on mu dev branch and plan to release it in v0.18

@lukaszsamson lukaszsamson added bug Something isn't working work in progress labels Dec 3, 2023
lukaszsamson added a commit that referenced this issue Dec 3, 2023
…after all changes applied

This was broken since the original code drop (or may be an artefact of LSP 2.0)
Fixes #1024
lukaszsamson added a commit that referenced this issue Dec 7, 2023
…after all changes applied

This was broken since the original code drop (or may be an artefact of LSP 2.0)
Fixes #1024
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

Successfully merging a pull request may close this issue.

2 participants