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

crashes when typing Elixir in an new, unsaved file set to Elixir language #926

Closed
simonmcconnell opened this issue Jun 29, 2023 · 0 comments

Comments

@simonmcconnell
Copy link
Sponsor

Environment

  • Elixir & Erlang versions (elixir --version): 1.14.5 & 25.3.2.2
  • Elixir Language Server version: 0.15.1
  • Operating system: Debian 12 (remoted in from Windows 11 using the built in remote development)
  • Editor or IDE name (e.g. Emacs/VSCode): VSCode
  • Editor Plugin/LSP Client name and version: 0.15.1
Running /home/cmo/.vscode-server/extensions/jakebecker.elixir-ls-0.15.1/elixir-ls-release/launch.sh
Looking for ASDF install in /home/cmo/.asdf/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /home/cmo/.asdf/asdf.sh
Sourcing ASDF
Installing ElixirLS release v0.15.0
Running in /home/cmo/app
Install complete
[Info  - 3:05:16 pm] Started ElixirLS v0.15.0
[Info  - 3:05:16 pm] Running in /home/cmo/app
[Info  - 3:05:16 pm] ElixirLS built with elixir "1.14.5" on OTP "25"
[Info  - 3:05:16 pm] Running on elixir "1.14.5 (compiled with Erlang/OTP 25)" on OTP "25"
[Info  - 3:05:17 pm] Protocols are not consolidated
[Info  - 3:05:17 pm] Elixir sources not found (checking in /home/build/elixir). Code navigation to Elixir modules disabled.
dets: file "/home/cmo/app/.elixir_ls/calls.dets" not properly closed, repairing ...
[Info  - 3:05:19 pm] Loaded DETS databases in 420ms
[Info  - 3:05:19 pm] Starting build with MIX_ENV: test MIX_TARGET: host

Current behavior

I was working on my project, created a new file with ctrl+n, changed the Language Mode for the file to Elixir, formatted it. When I type some code in, the completion backend seems to crash ElixirLS.

[Error - 2:56:49 pm] GenServer ElixirLS.LanguageServer.Server terminating
** (FunctionClauseError) no function clause matching in ElixirLS.LanguageServer.SourceFile.formatter_for/2
    (language_server 0.15.0) lib/language_server/source_file.ex:236: ElixirLS.LanguageServer.SourceFile.formatter_for("untitled:Untitled-1", "/home/cmo/app")
    (language_server 0.15.0) lib/language_server/server.ex:709: ElixirLS.LanguageServer.Server.handle_request/2
    (language_server 0.15.0) lib/language_server/server.ex:518: ElixirLS.LanguageServer.Server.handle_request_packet/3
    (language_server 0.15.0) lib/language_server/server.ex:176: ElixirLS.LanguageServer.Server.handle_cast/2
    (stdlib 4.3.1.1) gen_server.erl:1123: :gen_server.try_dispatch/4
    (stdlib 4.3.1.1) gen_server.erl:1200: :gen_server.handle_msg/6
    (stdlib 4.3.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:receive_packet, %{"id" => 1271, "jsonrpc" => "2.0", "method" => "textDocument/completion", "params" => %{"context" => %{"triggerCharacter" => "@", "triggerKind" => 2}, "position" => %{"character" => 25, "line" => 2}, "textDocument" => %{"uri" => "untitled:Untitled-1"}}}}}
State: %ElixirLS.LanguageServer.Server{server_instance_id: "XdedLIjKKjdzCpUaSJ7ZyvLPnyZl4sAc", build_ref: #Reference<0.1115380041.1547436033.78918>, dialyzer_sup: #PID<0.326.0>, client_capabilities: %{"general" => %{"markdown" => %{"parser" => "marked", "version" => "1.1.0"}, "positionEncodings" => ["utf-16"], "regularExpressions" => %{"engine" => "ECMAScript", "version" => "ES2020"}, "staleRequestSupport" => %{"cancel" => true, "retryOnContentModified" => ["textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta"]}}, "notebookDocument" => %{"synchronization" => %{"dynamicRegistration" => true, "executionSummarySupport" => true}}, "textDocument" => %{"callHierarchy" => %{"dynamicRegistration" => true}, "codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports"]}}, "dataSupport" => true, "disabledSupport" => true, "dynamicRegistration" => true, "honorsChangeAnnotations" => false, "isPreferredSupport" => true, "resolveSupport" => %{"properties" => ["edit"]}}, "codeLens" => %{"dynamicRegistration" => true}, "colorProvider" => %{"dynamicRegistration" => true}, "completion" => %{"completionItem" => %{"commitCharactersSupport" => true, "deprecatedSupport" => true, "documentationFormat" => ["markdown", "plaintext"], "insertReplaceSupport" => true, "insertTextModeSupport" => %{"valueSet" => [1, 2]}, "labelDetailsSupport" => true, "preselectSupport" => true, "resolveSupport" => %{"properties" => ["documentation", "detail", "additionalTextEdits"]}, "snippetSupport" => true, "tagSupport" => %{"valueSet" => [1]}}, "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]}, "completionList" => %{"itemDefaults" => ["commitCharacters", "editRange", "insertTextFormat", "insertTextMode"]}, "contextSupport" => true, "dynamicRegistration" => true, "insertTextMode" => 2}, "declaration" => %{"dynamicRegistration" => true, "linkSupport" => true}, "definition" => %{"dynamicRegistration" => true, "linkSupport" => true}, "diagnostic" => %{"dynamicRegistration" => true, "relatedDocumentSupport" => false}, "documentHighlight" => %{"dynamicRegistration" => true}, "documentLink" => %{"dynamicRegistration" => true, "tooltipSupport" => true}, "documentSymbol" => %{"dynamicRegistration" => true, "hierarchicalDocumentSymbolSupport" => true, "labelSupport" => 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]}}, "foldingRange" => %{"dynamicRegistration" => true, "foldingRange" => %{"collapsedText" => false}, "foldingRangeKind" => %{"valueSet" => ["comment", "imports", "region"]}, "lineFoldingOnly" => true, "rangeLimit" => 5000}, "formatting" => %{"dynamicRegistration" => true}, "hover" => %{"contentFormat" => ["markdown", "plaintext"], "dynamicRegistration" => true}, "implementation" => %{"dynamicRegistration" => true, "linkSupport" => true}, "inlayHint" => %{"dynamicRegistration" => true, "resolveSupport" => %{"properties" => ["tooltip", "textEdits", "label.tooltip", "label.location", "label.command"]}}, "inlineValue" => %{"dynamicRegistration" => true}, "linkedEditingRange" => %{"dynamicRegistration" => true}, "onTypeFormatting" => %{"dynamicRegistration" => true}, "publishDiagnostics" => %{"codeDescriptionSupport" => true, "dataSupport" => true, "relatedInformation" => true, "tagSupport" => %{"valueSet" => [1, 2]}, "versionSupport" => false}, "rangeFormatting" => %{"dynamicRegistration" => true}, "references" => %{"dynamicRegistration" => true}, "rename" => %{"dynamicRegistration" => true, "honorsChangeAnnotations" => true, "prepareSupport" => true, "prepareSupportDefaultBehavior" => 1}, "selectionRange" => %{"dynamicRegistration" => true}, "semanticTokens" => %{"augmentsSyntaxTokens" => true, "dynamicRegistration" => true, "formats" => ["relative"], "multilineTokenSupport" => false, "overlappingTokenSupport" => false, "requests" => %{"full" => %{"delta" => true}, "range" => true}, "serverCancelSupport" => true, "tokenModifiers" => ["declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary"], "tokenTypes" => ["namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", ...]}, "signatureHelp" => %{"contextSupport" => true, "dynamicRegistration" => true, "signatureInformation" => %{"activeParameterSupport" => true, "documentationFormat" => ["markdown", "plaintext"], "parameterInformation" => %{"labelOffsetSupport" => true}}}, "synchronization" => %{"didSave" => true, "dynamicRegistration" => true, "willSave" => true, "willSaveWaitUntil" => true}, "typeDefinition" => %{"dynamicRegistration" => true, "linkSupport" => true}, "typeHierarchy" => %{"dynamicRegistration" => true}}, "window" => %{"showDocument" => %{"support" => true}, "showMessage" => %{"messageActionItem" => %{"additionalPropertiesSupport" => true}}, "workDoneProgress" => true}, "workspace" => %{"applyEdit" => true, "codeLens" => %{"refreshSupport" => true}, "configuration" => true, "diagnostics" => %{"refreshSupport" => true}, "didChangeConfiguration" => %{"dynamicRegistration" => true}, "didChangeWatchedFiles" => %{"dynamicRegistration" => true, "relativePatternSupport" => true}, "executeCommand" => %{"dynamicRegistration" => true}, "fileOperations" => %{"didCreate" => true, "didDelete" => true, "didRename" => true, "dynamicRegistration" => true, "willCreate" => true, "willDelete" => true, "willRename" => true}, "inlayHint" => %{"refreshSupport" => true}, "inlineValue" => %{"refreshSupport" => true}, "semanticTokens" => %{"refreshSupport" => true}, "symbol" => %{"dynamicRegistration" => true, "resolveSupport" => %{"properties" => ["location.range"]}, "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, ...]}, "tagSupport" => %{"valueSet" => [1]}}, "workspaceEdit" => %{"changeAnnotationSupport" => %{"groupsOnLabel" => true}, "documentChanges" => true, "failureHandling" => "textOnlyTransactional", "normalizesLineEndings" => true, "resourceOperations" => ["create", "rename", "delete"]}}}, root_uri: "file:///home/cmo/app", project_dir: "/home/cmo/app", settings: %{}, build_diagnostics: [%Mix.Task.Compiler.Diagnostic{file: "/home/cmo/app/lib/app/participation.ex", severity: :warning, message: "invalid association `user` in schema App.Participation: associated schema User does not exist", position: 1, compiler_name: "Elixir", details: nil}], dialyzer_diagnostics: [%Mix.Task.Compiler.Diagnostic{file: "/h (truncated)
[Error - 2:56:49 pm] GenServer #PID<0.326.0> terminating

Expected behavior

Doesn't crash.

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

1 participant