Closed lunny closed 1 year ago
There's also the hooks editor which uses monaco.
I think we have two style of editors to support:
- Full-Blown Code editor. Currently using monaco but I think we could in the future replace it with full VSCode if there is a suitable module to use, similar to GitHub CodeSpaces, but more integrated in the UI.
There's code-server, which is basically just as easy to install as Gitea and both play nicely together running on the same server (running both as services on Ubuntu 20.04, using Caddy and no-IP to have nice domain names). At the moment, having both Gitea and code-server on the same machine means duplicating git repos on the same machine which could get silly. Code-server is deliberately a bit un-opinionated for how it's hosted or wrapped, and some projects exist that do interesting things with that in mind:
Some way to integrate code-server "into"/"alongside" a Gitea server would be really cool, Theia is another candidate but has problems with both more complicated architecture (I've never managed to get either Gitpod or Eclipse Che to run on my server, which is why I'm using code-server) and way more limited extension and feature support compared to code-server.
Yeah, I've seen code-server before but it seems like a can of worms to me because it requires a backend server so it would probably be a nightmare to integrate into gitea. I think if we consider integrating some version of VSCode, it must be client-side only which could be integrated with the existing gitea API with some glue code.
FWIW Gitpod.io is working on supporting arbitrary git repos, which would allow gitea integration (they also are a $5/mo sponsor on opencollective, so who knows maybe they are planning on tighter integration?)
There’s an architecture I can think of that, while a tad janky, would work with little modification of either code-server or Gitea.
As far as I understand, Gitea runs on top of Git in a fairly traditional fashion: edits made, even to the local repo storage for Gitea, don’t show up in Gitea on a repo’s page unless you commit the changes as it only shows what has been committed. In that case, a fairly simple plugin could allow code-server, ran by the Gitea user in a naive single-instance setup, to show local Gitea repos in the UI and open those locally stored repos to edit them in-place. As far as I know, that wouldn’t cause problems and would allow for the actual code-server “server” to stay out of Gitea. The only code on Gitea’s side would be a way to embed the code-server front end (which is distinct from the server) and hook it up to the code-server backend running separately if you want it to fully replace the current Monaco editor. The only serious problem I can see in this is that code-server doesn’t support multi-tenancy beyond just spinning up more instances in VMs.
The only “correct” way I can think of supporting this to scalable, HA deployments would be to run Gitea in a Kubernetes or Docker Swarm cluster, then allowing Gitea to spin up (and down) code-server containers and issue them one per editing user.
CodeMirror 6 might be a possible replacement for Monaco, it's a from-scratch rewrite of CodeMirror 5. Need to test how it behaves on Mobile and how the language support is (I think Monaco is still better in terms of language support and IntelliSense).
I will close this as #23876 merged.
Yeah for code editor, last I checked, Monaco is still the must featureful editor around. CodeMirror 6 lacks on a few fronts like language support.
I think we should clarify all the types of editors on Gitea UI before we have any decision. There are three editors on ui of Gitea
issue/comment/release editor Now gitea is using EasyMDE with a switch to textarea (no turn back).
Wiki editor Currently gitea is using the same editor as first one.
file editor Now gitea is using monaco, but for markdown file it's not perfect.
Hooks editor Also use monaco