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

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

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

zachallaun
Copy link
Collaborator

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).

@zachallaun zachallaun requested a review from scohen June 18, 2024 15:24
@zachallaun zachallaun force-pushed the za-completion-abstractions-refactor branch from 51e344a to f5d70f9 Compare June 25, 2024 13:48
@Moosieus
Copy link
Collaborator

Moosieus commented Jul 2, 2024

Found this from a conversation a few months ago:

I remember why builder is a behaviour, plug-ins. If it wasn't, we'd have to marry releases of lexical-plugin to releases of lexical, and move builder code to lexical-plugin.

Not sure if the same applies to Lexical.Ast.Env though.

@zachallaun
Copy link
Collaborator Author

@Moosieus Hmm, I'm not sure I'm following that. lexical_plugin only has a dependency on lexical_shared, and lexical_shared is the "root" so to speak: it has no dependencies on any other part of Lexical. That should mean it's safe to move around anything in apps/*, as nothing in projects/* depends on them.

@scohen
Copy link
Collaborator

scohen commented Jul 3, 2024

It's the other way. The intention behind these behaviours was that we could then move things to lexical_shared, publish the behaviour there and have lexical_shared provide an implementation, and then lexical would provide the real implementation.

@zachallaun
Copy link
Collaborator Author

It's the other way. The intention behind these behaviours was that we could then move things to lexical_shared, publish the behaviour there and have lexical_shared provide an implementation, and then lexical would provide the real implementation.

While I think that's reasonable, I think that this simplification is worth doing for now for a few reasons:

  • We haven't moved it to lexical_shared, and to my knowledge it isn't anyone's priority
  • There are questions about the utility/design of plugins anyways
  • This simplifies things for current contributors at the possible expense of a slightly harder refactoring if we want to turn this into a behaviour later

@scohen
Copy link
Collaborator

scohen commented Jul 3, 2024

Yes, i'm generally on board with this simplification, just giving you the context.

@zachallaun zachallaun force-pushed the za-completion-abstractions-refactor branch from f5d70f9 to 0333c7d Compare July 10, 2024 14:02
@zachallaun zachallaun merged commit f920acc into main Jul 10, 2024
12 checks passed
@zachallaun zachallaun deleted the za-completion-abstractions-refactor branch July 10, 2024 14:07
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

Successfully merging this pull request may close these issues.

3 participants