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

Next step: Language agnostic (polyglot) cataclysm via LSP #6

Open
Boscop opened this issue Apr 14, 2023 · 0 comments
Open

Next step: Language agnostic (polyglot) cataclysm via LSP #6

Boscop opened this issue Apr 14, 2023 · 0 comments

Comments

@Boscop
Copy link

Boscop commented Apr 14, 2023

I would love to use cataclysm in real world projects, with any language for which a LSP server exists (which are quite a lot).
I would especially like to use it with more strongly typed languages like Rust or TypeScript.
Instead of analyzing the context / globals via run-time reflection, the LSP can be queried.
Code should ideally be generated into the editor instead of being executed blindly, to avoid actual cataclysm ;)

The way it could work is, as a LSP middleman AI:

  • Write any code that references non-existing types and functions (either write by hand or copy paste from somewhere else, or generate with github copilot)
  • LSP complains that there are undefined symbols
  • For each undefined symbol, tell the LSP middleman AI to generate a definition (by moving your cursor onto the identifier and invoking the "generate symbol definition with GPT" action)
  • It inserts them at the next appropriate outer scope (the scope that is closest to the cursor but such that the symbol will be in scope for all references to it that the user just wrote)
  • The human proofreads the generated code / adjusts
  • Repeat workflow until done

LSP would provide enough context for GPT to generate appropriate types and functions that match the expected signatures.
If GPT should also mirror the project's coding style and naming convention inside the body of generated functions, then maybe feeding it the project's source code as custom embeddings would make sense. But as a first step, the info that LSP provides should be sufficient!
I think in languages with strong typing, this would allow GPT to work even better because it doesn't have to infer the types by itself, it can just query the LSP! And the type checker would catch some mistakes. (With type driven development, the user can write the types more expressively to get better AI-generated code.)

tl;dr: Polyglot cataclysm in every language that supports LSP!
What do you think?

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

No branches or pull requests

1 participant