VisualStudio Code on Haiku

I’ve been watching the steady development progress on Haiku for some years now. I’m a professional developer with 25 yrs experience and I’d like very much to help the Haiku team alas my free time is inexistent. Some day though… :slight_smile:

In the meantime I was wondering if we’ll ever get my favorite IDE ported to Haiku - VisualStudio Code. Is Electron already working on Haiku?

Cheers!

1 Like

Don’t expect VisualStudio on Haiku (we are not Windows) :slight_smile:
But you could build Lazarus with FPCUPdeluxe which you can install through HaikuDepot.

FPCUPdeluxe

Lazarus-fpcupdeluxe

1 Like

VS Code is very different than Visual Studio. It’s based on Electron and it’s cross-platform. I use it as my daily development IDE for Mac, Win and Linux.

2 Likes

My bad then :wink:

If it works in Wine, then I would expect it to eventually work in Haiku.

1 Like

Electron is also not available for Haiku because it needs Chromium,which is not available for Haiku and doesn’t accept upstream patches for any operation systems other than Windows,Linux and macOS.
And the last time I tried,Wine couldn’t run recent Chromium versions,but that was some years ago so it may have changed.

3 Likes

Is KDevelop not working right now? That’s what I use. VS tends to hard-freeze my working PC needing a hard restart of the PC. Not needed on Haiku this is…

1 Like

KDevelop is available in HaikuDepot/pkgman, so I assume that it is working. (I don’t use it myself)

Well, what’s needed or not is always a very personal thing, isn’t it? :wink:

Some programs in HaikuDepot does not work for full use… and are still in HaikuDepot!

1 Like

Thanks nipos, that was useful to know. I know next to nothing about Electron but isn’t it based on Node.js? If Node is available for Haiku, does it still need Chromium?

A bunch of apps are based on Electron besides VS Code (Slack is another popular one). Having Electron available would benefit Haiku I think. I agree that this is not high on the priority list but I hope at some point in the future we’ll get there.

Yes. Nodejs is a JavaScript engine. But Chromium is a web browser engine, and Electron uses it to render the user interfaces of Electron based apps.

2 Likes

Ah, got it, thanks. On a second thought, I think I don’t want Electron on Haiku anyway, what I (and a bunch of other people I assume) like especially about Haiku is how light it is. Chromium is a beast (probably bigger than the whole Haiku) and running one (or multiple) Electron apps/instances would explode the memory/resource requirements.

I found this page which lists some lightweight alternatives to Electron.

But I think the higher priority is porting a newer Webkit (2?) To Haiku (at least if this blog post is still relevant).
Is there any significant effort underway in that direction? I’m pondering if I should jump in and help with that…

I have never programmed using it myself, but I know that Electron exposes some things from the OS in a JavaScript API and also provides a way to run a JavaScript app in a native looking window.

It might be possible to build another runtime on Haiku which has the Electron API but uses WebKit and other Haiku APIs. I don’t think anyone else has done this on other operating systems since Electron is supported on the three major systems. But people have built alternatives which use different technologies but are kind of the same idea, like Ultralight in C++ or Tauri in Rust.

Also the core JavaScript editor in VSCode, Monaco, can be just run in a web browser, and I believe now they added it to GitHub. So another alternative might be to have a native Monaco wrapper which has some ideas from Electron but maybe not a full clone of the API.

Or for a lot less work everyone can just use the editors currently available on Haiku. :slight_smile:

Even on macOS I decided to switch to Emacs from VSCode and I am pretty happy, though I still use VSCode on Windows.

Though in general it might be a fun project to make a lightweight and “Haiku-friendly” way to run little JavaScript apps. There is plenty of ideas out there to look at for inspiration.

3 Likes

Also the core JavaScript editor in VSCode, Monaco, can be just run in a web browser, and I believe now they added it to GitHub. So another alternative might be to have a native Monaco wrapper which has some ideas from Electron but maybe not a full clone of the API.

I am not hung up on VS Code. I do like the editor indeed (I tried picking up Emacs like three times in my life and it never sticked) and I like the source indexer and how “lightweight” it feels compared to Visual Studio. Debugger is also pretty good and I like that I can use VS Code for my main languages I use (C++, Python and Scala). The plugin/extensions ecosystem is nice too.

All that being said I can work with another IDE that is somewhat similar and it’s not “opinionated” and gets out of the way.

It might be possible to build another runtime on Haiku which has the Electron API but uses WebKit and other Haiku APIs.

I thought about the same but I’m not sure how much work that would be. We should keep this idea on the TODO list…

Qt Creator, ported to Haiku, may work for you since it supports Scala and Python plug-ins. You get many of VS Code core features.

There are some recreations and/or replacements of the legacy BeIDE tool. Possibly on a TODO or GSoC list.

2 Likes

FYI: the HaikuPorts team decided to not port/support any electron based programs (at least the statically linked ones, afaik).

1 Like

Yes it is work going on with Webkit 2.
Pulkomandy started on porting it!
The devs will be happy to get help here.

2 Likes

Yeah, WebKit2 would be great, since with that I could implement xwidget (embedded browser) support in the Emacs port.

Thanks in advance.

Webkit2 is not a new webrowser engine, it is another api to webkit which we already have ported. (we use webkitlegacy now, the api)

Read about progress here: My progress on WebKit2 port

2 Likes

A lightweight runtime for Electron sounds like a good idea,but I think it’s complicated.
Electron is really awful,I try to avoid it on every OS and haven’t used any Electron app for over a year I think,but unfortunately this stuff is really popular because it makes it really easy to create one application for every platform (with the cost of OS-integration,native look and feel,good performance,low memory footprint,… but nobody seems to care).
As there’s a huge demand for it,it would be favorable if anyone can make a lightweight runtime,preferably based on HaikuWebKit and dynamically linked to the apps,before anyone steps in and actually ports the whole Chromium bloat and brings huge statically-linked Chromium+Webapp binaries to Haiku.
Electron provides very many custom APIs however,which HaikuWebKit and other webbrowser engines don’t offer and all of those need to be rewritten from scratch to work with HaikuWebKit if you want to make it a drop-in replacement that works without changing anything in the Electron apps.
And I think a drop-in replacement is the only thing that makes sense,because Electron app developers take cross-platform compatibility for granted and won’t care about a custom runtime of a niche OS that they’ve never heard of before.

I already looked at Ultralight before and it won’t work.
You can see big parts of it on Github,but unfortunately their renderer UltralightCore is proprietary as they state in the Readme of the Ultralight repo: https://github.com/ultralight-ux/ultralight#comparison-with-chromium
That means we won’t be able to compile the whole thing for Haiku,except if anyone buys a paid license for 2000 dollars,but then we won’t be allowed to use it for more than one app.
I hoped that Ultralight could be the base for a more modern Webbrowser on Haiku before the QtWebEngine port happened,so I had a deep look into it already,but can’t remember all links that state that it won’t work.

Tauri looks much better as it’s completely open-source and therefore could be compiled on Haiku,but I didn’t know it before and haven’t tried it.
It works with the native web engine on each platform,so it should be possible to integrate it with HaiikuWebKit,but I don’t know how much work that will be.
Also it doesn’t look like a drop-in replacement for Electron but rather an alternative for app developers,which must completely optimize their app for Tauri instead of Electon then (possibly rewriting all custom APIs,but I haven’t looked into the details).

That being said,that’s all a mix of personal opinions and my experience when using Electron ugh and looking into Ultralight.
I have not that much experience with C++ programming and web browsers that I could help in any way with creating the native Electron app runtime :confused:

2 Likes