rapid unscheduled torment nexus disassembly expert — nonbinary, she/they, 27 — writes Racket — twitter.com/doitwithalambda — mastodon.social/web/@notjack

posts from @notjack tagged #code

also:

So I've been thinking about three things:

  • The devcontainers project is an open specification that makes it possible for anyone to automatically set up VS Code for a github repo with a .devcontainer.json file in it. GitHub uses it for its Codespaces feature.

  • VS Code is powered by the language server protocol (LSP).

  • LSP specifies how language servers can inform clients of issues in the code by sending Diagnostics. Language servers can also tell clients how to automatically fix those issues by sending Code Actions.

This means that it should be possible to make a generic tool that can, for any repository with devcontainers set up, report and fix diagnostics for code in that repository.

I'm thinking about this because recently I made Resyntax, a Racket tool that analyzes code and suggests improvements. And I spent a lot of time getting it to integrate with GitHub actions and pull requests, so that I could see Resyntax's suggestions in the form of a pull request review like this one. This has some downsides:

  • It only works for pull request reviews. I really want Resyntax's suggestions to show up in editors too. That requires integrating with LSP and using diagnostics and code actions to report suggestions. That's doable, but I can't really reuse any of the existing GitHub integration work I've done.
  • It only works for Resyntax. The racket langserver implementation already reports some diagnostics of its own, such as unused imports. And in theory, languages other than Racket exist and have their own langservers, or so I'm told.

So I'd really like to see a GitHub action that reviews pull requests that I can just plug into any repository with devcontainers. It should start up a container for each pull request with that pull request's files checked out, attach to the langserver, collect diagnostics and code actions, and report them as comments in a pull request review with suggested fixes attached. Does anyone know if anyone's working on something like this? It's general enough that I assume someone working on the devcontainers spec or adjacent tooling has had this idea already.