TypeFox / monaco-components

Monaco Editor and Language Client Wrapper, plus Monaco Editor React Component
MIT License
42 stars 13 forks source link

allow to pass a uri via editor config and model update #29

Closed ChristophKuper closed 1 year ago

ChristophKuper commented 1 year ago

Before it was not possible to use on wrapper and load different code into it because the uri for this code will always be defined by an id passed to the wrapper constructor.

With this change the uri can be set similar to the the code itself. This way the language server can differ between two file contents.

@kaisalmen Is this an appropriate change or are there other ways ? Thanks in advance 😃

kaisalmen commented 1 year ago

@ChristophKuper thank you very much. This looks good. Do you want to alter one of the existing examples to demonstrate this?

ChristophKuper commented 1 year ago

@kaisalmen okay i adjusted the example. i also aligned some variables to be more clear while switching between code & original code

kaisalmen commented 1 year ago

⬆️ updateDiffModel has to be used here instead of updateModel depending which editor is active. The eslint check failed, but fixes are easy.

ChristophKuper commented 1 year ago

@kaisalmen thx i quickly fixed the linting and allowed also updating in case a diff editor is open.

kaisalmen commented 1 year ago

@ChristophKuper I just released new npm packages. Forgot to do this.