microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.44k stars 28.62k forks source link

Move away from electron #118308

Closed Milo123459 closed 1 year ago

Milo123459 commented 3 years ago

Hey,

This is not really a feature request, but more of an overall suggestion. I've been interested in something called tauri for a while now, it's basically electron but written in Rust and is extremely lightweight, but not yet stable. It is also a lot more secure.

Moving away from electron and moving to tauri would be a big performance upgrade, allowing for more low-end devices to use VSC.

Obviously, this'd be a lot of work but I think it'd be worth it. I'm pretty sure something inside the vscode package for making extensions would have to change. I'd be happy to help if need be.

This is not urgent at all, but, would be worth it in my opinion.

pixieaka commented 3 years ago
Sounds good! Detail Tauri Electron
Installer Size Linux 3.1 MB 52.1 MB
Memory Consumption Linux 180 MB 462 MB
Launch Time Linux 0.39s .80s
Interface Service Provider Varies Chromium
Backend Binding Rust Node.js (ECMAScript)
Underlying Engine C/C++ V8 (C/C++)
FLOSS Yes No
Multithreading Yes Yes
Bytecode Delivery Yes No
Multiple Windows Soon Yes
Auto Updater Soon Yes (1)
Cross Platform Yes Yes
Custom App Icon Yes Yes
Windows Binary Yes Yes
MacOS Binary Yes Yes
Linux Binary Yes Yes
iOS Binary Soon No
Android Binary Soon No
Desktop Tray Soon Yes
Sidecar Binaries Yes No

Notes Electron has no native auto updater on Linux, but is offered by electron-packager

Milo123459 commented 3 years ago

Yea, it's quite an amazing piece of technology. I'm happy to help out making it!

Milo123459 commented 3 years ago

Oh, tauri is also more secure as it's harder to inject code into applications.

Milo123459 commented 3 years ago

Also, I'm not entirely sure how VScode renders things, like, if it uses a framework like React or something. AFAIK tauri works by using bundled code from a framework, don't quote me on that tho.

pixieaka commented 3 years ago

@Milo123459 https://www.youtube.com/watch?v=gnKzJRr-rd0

Milo123459 commented 3 years ago

I'll check that out when I get home. What is the video on?

pixieaka commented 3 years ago

@Milo123459 The answer for your question from VS Code team. What frontend framework does VS Code use?

Milo123459 commented 3 years ago

Oh 😅 Will checkout later, 👍

Milo123459 commented 3 years ago

Ah, I see, it doesn't use a framework. It just needs to be compiled to html/css/js

swise0 commented 3 years ago

Front end framework is different.. we are talking about the native run time of the VS code app . Which i think Tauri is a very compatible rust (most loved language of programmers) framework for...

Milo123459 commented 2 years ago

I've done some initial research, and realised it's easier than I thought™. I might be able to create a PR soon.

swise0 commented 2 years ago

Should you require a frontend framework with huge Performance and low memory overhead, I'd recommend Solidjs on your journey

Arcitec commented 2 years ago

Should you require a frontend framework with huge Performance and low memory overhead, I'd recommend Solidjs on your journey

He's trying to replace the web browser wrapper/executable. Not rewrite the entire HTML GUI, lol.

Milo123459 commented 2 years ago

If rewriting the entire GUI was easier than I thought:tm: then I think someone else would've done that haha. Currently, this is in my personal backlog of things I'm working on, and, is requiring another project I've been working on that can safely (at build-time) convert Electron to Tauri, no config required. It runs tests etc, to ensure it runs the same, but it's pretty massive and taking a while. I'll run this tool on this app when the tool is done.

Arcitec commented 2 years ago

@Milo123459 Wow, that's amazing. I hope it goes well. If it is a big task, perhaps open source it (the converter) now to look for collaborators. I bet many Tauri users or even development team would join you.

Milo123459 commented 2 years ago

Haha, currently 15K LOC into it; it's going pretty well with full interop for all electron APIs. I'll opensource it once it works, and well, I'll test it on VSCode :)

Arcitec commented 2 years ago

Woah. 😳 Thumbs up. 👍

Milo123459 commented 2 years ago

Update: Started working on it with a friend. Decided to double down and add some more technologies into it (Tauri + GPU acceleration). It's coming together, but, taking a while. This project is massive, and well, hope it'll be used!

quentincaffeino commented 2 years ago

Glad to hear that!

This project is massive, and well, hope it'll be used!

If it would be basically a drop-in replacement or at least support >=50% of main features I'll definitely switch cause I have to run very low-end devicss from time to time.

Milo123459 commented 2 years ago

Drop-in replacement; one command and generates it for you. It runs all the tests to ensure the app runs smoothly and stuff like that.

NoelJacob commented 2 years ago

@Milo123459 Any progress? I'm intending to try making a fork.

Milo123459 commented 2 years ago

Sadly no

TheFireCircle commented 2 years ago

I am very curious about the current state too. Are there any problems?

Milo123459 commented 2 years ago

Well, I haven't been able to work on it all that much. I have covid rn which is a bit of a blocker, along with lots of API changes. In the current state of the project, I can't just make it work. I think the best course of action is just manually migrating the vscode repo to use Tauri.

Leedehai commented 2 years ago

Tauri uses different browser engines on different platforms, so it'll be Edge/Chromium on Windows, WebKit on macOS, etc. For a large & complex project like VSCode, I guess issues caused by nuanced inconsistencies across different browser engines are hard to investigate... one more layer to worry about.

Milo123459 commented 2 years ago

Yeah, good point. It'll be like debugging issues on the browser version.

Unfortunately, I have had to move away from working on this (a while ago) due to some important IRL things going on for me. If anyone wants to take a stab at this, feel free.

Milo123459 commented 2 years ago

Tauri 1.0 has been released!

https://tauri.app/blog/tauri_1_0

blyxyas commented 2 years ago

Is there any project porting VSCode from Electron to Tauri? I haven't found any

tgross35 commented 2 years ago

Hey @Milo123459 is the app you were working on posted anywhere? If not, would you maybe interested in making what you have public, even if not running/finished?

Tauri is gaining a ton of steam, I feel like there is quite a need for the kind of thing you discussed (not sure how far you've gotten)

Milo123459 commented 2 years ago

I don't have much progress because it was using a super outdated version. I might start working on it again, not sure.

mrnossiom commented 1 year ago

Even though, migrating such a codebase that is deeply rooted in Electron might take a while, it could offer the opportunity to port parts of the code to Rust, like compute intensive tasks... Also no VS Code Core team members expressed their thoughts on this PR. I guess this has been discussed in intern, but I would be willing to get their point of view.

Craig-Macomber commented 1 year ago

There was a related issue here: #142194 which was closed as out of scope. That was well before the "Tauri 1.0".

By the provided definitions of scope, it seems like this issue could be considered in scope now (It has a lot of responses, and is actionable in the short term).

Since VSCode also supports running in the browser, I suspect there shouldn't be too much compatibility work that is not also bug fixes for other browsers. Hopefully that helps address the "affordability" aspect of scoping this.

NoelJacob commented 1 year ago

Would it be easier to change to nutralino.js instead of Tauri? https://github.com/Elanis/web-to-desktop-framework-comparison

arun-cm commented 1 year ago

Tauri uses different browser engines on different platforms, so it'll be Edge/Chromium on Windows, WebKit on macOS, etc. For a large & complex project like VSCode, I guess issues caused by nuanced inconsistencies across different browser engines are hard to investigate... one more layer to worry about.

image

arun-cm commented 1 year ago

Now tauri is using https://github.com/tauri-apps/wry - Cross-platform WebView library in Rust

mrnossiom commented 1 year ago

Always has been

vdvman1 commented 1 year ago

The references to the webview used on each platform is talking about what wry ultimately uses under the hood

Anutrix commented 1 year ago

Milo123459 Any updates? Any draft MRs might also be good.

Milo123459 commented 1 year ago

Me and a friend have started working on this again. No ETA, but progress is good.

plutoniumm commented 1 year ago

Hey @Milo123459 it seems the demand for a Rust VSC is significant, would you consider open sourcing? So maybe the community can join in? The VSC team in an issue before marked it as out of scope so it seems like for now this will have to be a community effort

If its a matter of monetisation then maybe you could try sponsorships on it I'm sure some money would start trickling in very soon

Milo123459 commented 1 year ago

Unfortunately, progress has kinda stopped. I don't think I intend on working on this again, but our approach was reading the .asar, converting all the APIS to tauri compatible APIs and scaffold it into a tauri project that could be built.

tgross35 commented 1 year ago

Publish what you have if you can! Even if it’s very incomplete, you’ve don’t some trial and error that will help others figure it out

sirus20x6 commented 1 year ago

Yes please just release the fork. let people have a stab at finishing it

AbhijithGanesh commented 1 year ago

Can anyone tell me, where I can find the fork? @Milo123459

pbarnum commented 1 year ago

It doesn't seem like @Milo123459 wants to open source their work, or no longer has the ability to do so. Either way it is unfortunate and someone else will need to start this from scratch.

Milo123459 commented 1 year ago

We never started it other than a few ways of finding out the ASAR file (which is extremely easy) and we were more working on theoretical things. We stopped working on this because we realised this would mean it would be hell to maintain, primarily because of changing APIs all the time. It's not that I don't want to share, it's literally that we have nothing.

AbhijithGanesh commented 1 year ago

I'd like to start work with this again, I might be an entire newbie to the dev-side of VSCode but I would like to try giving this a shot

AbhijithGanesh commented 1 year ago

As a first thing, I would like to open a draft PR tagging this issue. I hope this is the process

Milo123459 commented 1 year ago

Also, seeing how you wanted to do it: our work would be completely useless. You're trying to convert VSCode, we're trying to convert all Electron projects.

AbhijithGanesh commented 1 year ago

I am inclined to agree, my worries/concern were specifically over VSCode. I would like to make that a separate issue then. That will add more clarity