espruino / EspruinoWebIDE

The Espruino Web IDE - A Chrome Web App for programming Espruino
Apache License 2.0
366 stars 158 forks source link

Using Monaco editor instead of Codemirror #270

Closed TheGLander closed 1 week ago

TheGLander commented 2 years ago

Monaco editor is the editor library thing which powers Visual Studio Code, which I think is better than Codemirror with IntelliSense autocompletion and overall feel.

gfwilliams commented 2 years ago

Do you have any specific areas where you think it'd improve things? Bear in mind that key mappings/etc are all configurable in codemirror so from the 'feel' side of things I imagine it could be configured to be basically the same.

We do currently have some code completion in the Web IDE - and replicating that with the Monaco editor would likely be nontrivial as you'd have to be able to import all the information about the types of all the built-in functions. It's not just a matter of changing a few lines to swap over.

TheGLander commented 2 years ago

Monaco editor has very good IntelliSense which is based on TypeScript types, if maybe the declarations over at BangleApps are refined (I personally have some unpublished Espruino types which I can share), it could be way better than what CodeMirror has to say. I understand that it would take a lot of effort to change to Monaco, but the gain from the better autocompletion is worth it, in my opinion.

gfwilliams commented 2 years ago

Can you maybe give some examples of how it's better?

Because I don't think most people notice but the IDE's autocomplete is actually pretty clever:

image

if maybe the declarations over at BangleApps are refined

Which declaratons? Are you talking about TypeScript?

Because the IDE currently has vastly more information available to it than is in the typescript decls:

I personally have some unpublished Espruino types which I can share

You mean for TypeScript again? Honestly, I'm not sure this is a massive help - they really need to be auto-generated from the Espruino source like the IDE's ones are, or they will pretty much always end up out of date (not to mention not including the documentation). You could add extra type info to the Espruino source code and then export the TypeScript from there, and that'd be great, but there is already quite a large amount of type info in there that could be used.

TheGLander commented 2 years ago

I meant the TypeScript declarations, sorry for not mentioning. Here's an example of what Monaco can do: Peek 2022-06-18 22-35 (online-video-cutter com) This is shown in TypeScript, but Monaco basically uses the TS engine for JS, so everything will work in JS as well. I think it would be great if Espruino interpreter/doc types could be exported to TypeScript declarations. An issue I think could happen is that TypeScript types can be way more complex that C so describing them in a doc format might be TS-centric, but I think it wouldn't be a bad thing if the reference documentation would use a single commonly-understood type format.

gfwilliams commented 1 week ago

Closing this - realistically the IDE does most of this already and anyone that really cares about this will actually really want to use VS Code itself