Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental project structure (#773)
* Experimental project structure This commit represents a new structure for the experimental project, and a path forward. With these changes the project now has: * A build option enabling the experimental server * Per-message routing for the experimental server. If enabled, it can either share messages with the existing server or take them over. Presently, the find references and formatting providers are implemented and "exclusive", meaning that they're handled solely by the experimental server * A consistent interface for building providers. * A consistent way to convert lsp messages into data structures and back again. This conversion is handled automatically for providers. * A genserver-like interface for providers to implement * Data structures representing LSP messages that are simple to define and build. * Fast and efficient conversion between utf8 and utf16. * A separation between what a provider does and how it responds to messages. This allows the work that underpins providers to be tested independently from the language server. * Add underscore code action Created a code action that prepends an underscore to unused variable names. * Notifications can be sent from the server * Properly handled spacing * Enforced required keys for jsonrpc messages * removed unused variable * Committed to pipeline * Added tests that check to ensure comments are preserved * Code modification framework First attempt at a standard interface for code modification. Code mod modules take the original text, the ast of the original text and arguments that they specify. They return a list of code edits or an error. * Simplified diff, change name of code action functions from appy to text_edits * Fixed off-by-one error that was vexing code unit conversions. The problem was that the character positions are _before_ the reported unit, so the 0th code unit is before the start of the line and the 1st code unit is the first character. The prior code added one to character counts to smooth this out, but you can't do that, because you could end up indexing into the middle of a multibyte character. * The code action needs to fix up the line numbers Code mods deal with snippets of code that need to have their line numbers fixed up by the code actions. * Fixed type spec The AST type is very complicated, and dialyzer was telling us I got it wrong. * Made type aliases a thing While working on the automatic protocol generators, it became clear that type aliases needed to be their own thing, as they operate quite differently from the other defined things in the jsonrpc protocol. Since they're just aliases, it makes sense to keep their definitions on hand and then spit them out when other things make use of them during encode and decode. This did require going back to encoding and ensuring all the encode functions return OK tuples. * Fixed unit tests When patches are unapplied, getting the beam file returned an empty path charlist, which dialyzer assumed was a real file name due to a weak assumption, which caused unit tests to fail. This was remedied by checking for a non-empty charlist, which allows tests to succeed. Also made patch a test only dependency for .formatter.exs, as this was causing formatters to fail. * removed unused module attribute * Added sourceror to ease ast to string conversion Under 1.12, Macro.to_string proudces wonky output, making `def` calls look like function calls by adding needless parenthesis. These parenthesis throw off the diff algorithm, and caused an off-by-one error in the code mod. Sourceror has backported the newer code generation so that it's compatible all the way back to 1.10, and produces the correct output. * Added patch as a dev dependency Patch's assertions will fail in CI due to `mix format --check-formatted` running in dev. Importing patch's deps in test will fix this. * Run check formatted in test so patch assertions work * Fixed dialyzer errors * Encapsulated sourceror
- Loading branch information