elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 196 forks source link

Weird 'Content-Length: n'$'\n' directories are created. #1094

Closed DJARUUN closed 4 months ago

DJARUUN commented 6 months ago

Environment

Current behavior

Since a bit ago now when im just using the Language server in a normal mix new project it gets really slow and creates these weird 'Content-Length: number'$'\n'(the single quotes are in the directory name) directories in the root of the project. After a little while (just a few minutes) the LSP doesn't react to any new changes and just stops working completely.

[WARN][2024-05-27 21:41:18] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:19] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:19] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:20] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:20] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:20] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:20] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:21] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:24] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:25] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:25] ...lsp/handlers.lua:626 'warning: outdented heredoc line. The contents inside the heredoc should be indented at the same level as the closing """. The following is forbidden:\n\n    def text do\n      """\n    contents\n      """\n    end\n\nInstead make sure the contents are indented as much as the heredoc closing:\n\n    def text do\n      """\n      contents\n      """\n    end\n\nThe current heredoc line is indented too little\n└─ nofile:21:24\n'
[WARN][2024-05-27 21:41:26] ...lsp/handlers.lua:626 '    warning: variable "contents" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 20 │             contents = """\n    │             ~\n    │\n    └─ lib/gonew.ex:20:13: Gonew.Main.create_project/1\n'
[WARN][2024-05-27 21:41:26] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 36 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:36:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:42:07] ...lsp/handlers.lua:626 'Unmatched request: %{"id" => 81, "jsonrpc" => "2.0", "method" => "workspace/executeCommand", "params" => %{"command" => "editor.action.triggerParameterHints", "title" => "Trigger Parameter Hint"}}'
[WARN][2024-05-27 21:42:47] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 38 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:38:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:42:55] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 38 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:38:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:43:40] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:43:53] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:43:59] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 41 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:41:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:01] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 41 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:41:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:07] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:08] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:10] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:12] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:44:27] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[START][2024-05-27 21:46:45] LSP logging initiated
[ERROR][2024-05-27 21:46:45] .../vim/lsp/rpc.lua:770    "rpc"   "/home/caarg/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" "stderr"    "Running /home/caarg/.local/share/nvim/mason/packages/elixir-ls/launch.sh\nPreferred shell is bash, relaunching\nLooking for ASDF install\nASDF install found in /home/linuxbrew/.linuxbrew/opt/asdf/libexec/asdf.sh, sourcing\n"
[ERROR][2024-05-27 21:46:45] .../vim/lsp/rpc.lua:770    "rpc"   "/home/caarg/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" "stderr"    "Installing ElixirLS release v0.21.3\n"
[ERROR][2024-05-27 21:46:45] .../vim/lsp/rpc.lua:770    "rpc"   "/home/caarg/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" "stderr"    "Running in /home/caarg/p/elixir/gonew\n"
[ERROR][2024-05-27 21:46:46] .../vim/lsp/rpc.lua:770    "rpc"   "/home/caarg/.local/share/nvim/mason/packages/elixir-ls/language_server.sh" "stderr"    "Install complete\n"
[WARN][2024-05-27 21:46:47] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'
[WARN][2024-05-27 21:47:03] ...lsp/handlers.lua:626 '    warning: variable "proj_name" is unused (if the variable is not meant to be used, prefix it with an underscore)\n    │\n 42 │   defp print_info(proj_name) do\n    │                   ~~~~~~~~~\n    │\n    └─ lib/gonew.ex:42:19: Gonew.Main.print_info/1\n'

I don't really know how to reproduce this. Out of nowhere this started happening while I was working on a mini project to get more familiar with Elixir and using it in Neovim. I just created a new project using mix and started working in it and this started happening.

Expected behavior

It should very much not create these weird directories (looks like a web request header or JSON thing) in the root of the project and should neither slow down tremendously to a complete stop after just a few minutes. Before this I've never had any issues with the LSP and it started out of nowhere.

DJARUUN commented 6 months ago

I've figured it out. The program I'm making is creating a file and a directory with it and when the LSP is like pre-running it to check for runtime things and that it was creating those directories and also the files inside of it that the program should create.

The reason for the weird directory names is from it getting the directory name in the program from the first element in System.argv() which I guess it it the Content-Length header when it's ran by the LSP.

This does still need to be done something with because it can't just be creating directories willy-nilly (especially with these weird names because of System.argv()) and messing up projects.

For example one big issue with this is the fact that the file manager im using in Neovim (Oil) doesn't correctly understand the newlines in the directory names and crashes when I try to open it in the root of the project. It also of course leaves a big mess in the project.

lukaszsamson commented 6 months ago

Please share a repo that reproduces it. elixir-ls doesn't run your program. It evaluates mix.exs and then run mix compile

lukaszsamson commented 4 months ago

Ping @DJAruun