rrrene / credo-proposals

Proposals for Credo, the Elixir code analysis tool with a focus on code consistency and teaching
MIT License
9 stars 0 forks source link

Feature: LSP Server #77

Open mhanberg opened 2 years ago

mhanberg commented 2 years ago

What do you want Credo to do?

The proposed feature would add a credo.lsp (mix credo.lsp) mix task that would start an LSP server for use in text editors. The LSP server would be able to provide full project diagnostics (credo warnings/errors/hints) to the editor for display.

Currently, the way most editors integrate with Credo is via running mix credo --format=flycheck path/to/file.ex on file change, parsing the results, and rendering the results in the editor.

This generally only shows the warnings/errors for the currently viewed file, and is slow, as it boots the VM from scratch every time.

The server concept would boot when the editor starts and communicate via stdin/stdout with a json rpc protocol (the Language Server Protocol). elixir-ls is an example of a full Elixir LS implementation.

Which existing behaviour would change?

This would be an additive patch, adding the mix task to start the server. and the server to run the checks when files change.

mhanberg commented 1 year ago

I have created https://github.com/elixir-tools/credo-language-server.