CodinGame / monaco-vscode-api

VSCode public API plugged on the monaco editor
MIT License
205 stars 29 forks source link

VSCode `TextEditor` API #441

Closed abentkamp closed 1 month ago

abentkamp commented 1 month ago

Is it possible to create an editor in the browser that follows the same API as VSCode's TextEditor (https://code.visualstudio.com/api/references/vscode-api#TextEditor) instead of Monaco's IEditor (https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.IEditor.html)?

Background info: I would like to reuse code from an existing VSCode extension.

CGNonofr commented 1 month ago

I would that that it's the whole point of this library ;)

abentkamp commented 1 month ago

Sounds great! However, the examples in the readme create editors via monaco.editor.create, which returns anIStandaloneCodeEditor. How can I create a TextEditor instead and add it to the DOM?

CGNonofr commented 1 month ago

That wouldn't be simple to explain how it works in a few line... The extension TextEditor api is used to control the VSCode editor from an extension host which can even run on another machine. You don't create TextEditor and add it to the dom, a TextEditor is an abstract entity

You configure the VSCode services to have the feature you need, then you'll be able to use its extension api to control the editors

abentkamp commented 1 month ago

Thanks, I think that comment helped me already!