go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.02k stars 5.49k forks source link

About Gitea editors #15070

Closed lunny closed 1 year ago

lunny commented 3 years ago

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

silverwind commented 3 years ago

There's also the hooks editor which uses monaco.

silverwind commented 3 years ago

I think we have two style of editors to support:

ronasuti commented 3 years ago
  • 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:

  1. OOTB CodeServer, which includes a Github auth proxy, LXC container wrapping of the code-server instance(s), and monitoring for these moving parts
  2. Colab Code, which allows you to run code-server from within a Colab instance (or anywhere you can run Python, presumably)
  3. VSCode Live, which provides Live Share features with concurrent users, almost on the level of Google Drive
  4. Pomerium code-server, which wraps code-server in Pomerium, an Identity-Aware proxy server, which allows you to run multiple completely different web services and have enterprise-class SSO (SAML, among many others) and advanced access controls stretching across them

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.

silverwind commented 3 years ago

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.

techknowlogick commented 3 years ago

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

ronasuti commented 3 years ago

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.

ronasuti commented 3 years ago

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.

silverwind commented 2 years ago

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

lunny commented 1 year ago

I will close this as #23876 merged.

silverwind commented 1 year ago

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.