lexical-lsp / lexical

Lexical is a next-generation elixir language server
776 stars 77 forks source link

Simplify and co-locate more completion abstractions in server #776

Open zachallaun opened 1 week ago

zachallaun commented 1 week ago

This PR attempts to make completion code easier to understand and work on.

Previously, code that explicitly referred to completions lived in common, server, and remote_control; after this PR, it all lives in server and remote_control. Because server can refer to protocol types, I was also able to dramatically simplify the types/specs used in the builder.

Additionally, two behaviours have been removed in favor of referring to their implementations directly: Lexical.Ast.Environment (which was only implemented by Lexical.Ast.Env), and Lexical.Completion.Builder (which was only implemented by Lexical.Server.CodeIntelligence.Completion.Builder). Removing some of this indirection also allowed Dialyzer to catch a few bugs in the types that lived in Lexical.Ast.Environment (now Lexical.Ast.Env).