mighty-gerbils / gerbil

Gerbil Scheme
https://cons.io
GNU Lesser General Public License v2.1
1.16k stars 112 forks source link

Integrated Development Environment support #1226

Open vyzo opened 6 months ago

vyzo commented 6 months ago

There is already work in progress to support swank/slime and LSP, and it is becoming apparent that there is a lot of common structure between IDE support programs.

We propose an :std/ide package, where we provide coomon structures for all IDEs and packages for swank, lsp etc underneath.

Common Functionality

In general there are three main usage patterns we want to support for IDEs:

Supporting Code navigation and reading

This is the most fundamental interaction mode. We need to support:

Interactive Code Evaluation

This can happen in two contexts:

In order to facilitate interaction, the IDE server can be instructed to evaluate code in a specific module context. Furthermore all the symbols in the current code should support introspection, as in navigation above.

Code Editing

This is perhaps most important, but also the most complex to implement. The server should keep track of the code as it is being edited, even though it cannot expand it yet. It should create a shadow module context, where it can provide information and completions as the user is editing. It should also provide interactive evaluation support in the partial module, provided it is syntactically correct and can expand.

Generally desirable features for interactive editing:

Related Issues and PRs

metaleap commented 5 months ago

interactive evaluation in an appropriate context

In my thinking of the VSCode extension and dev-ex I have in mind (but really not just vsc but practically any & all other LSP clients), for real rapid-iteration live-coding ideally the server side (lsp or ide package) should maintain a kind of longrunning / ongoing "interpreter session" that begins by loading up all source files in the "project" or editor session, and from then on tracks all on-the-fly client-side edits live (if the LSP client transmits them — the vsc one would — otherwise.. file-watching I guess?), whether they're already stored-on-disk or not.

This is of course already kinda-sorta-somewhat prerequisite for on-the-fly / as-you-type diagnostics — but really if done in a way that preserves "program state" (of non-function-typed globals and closure-captured-vars even as they're affected/mutated by one's ongoing interactive eval requests), you have "image-based development (without the image)". Enables lots of live-coding with less frequent need for always-another "run program from main, and debug" cycle.

metaleap commented 5 months ago

My list of to-be-exposed ide API functionality suggestions, with common caveats and subtleties covered — looks like a wall-of-text, but less so if one just attacks one little thing at a time (they're guess-ordered for presumed maximum reuse/build-upon-ability =)