TypeFox / monaco-languageclient

Repo hosts npm packages for monaco-languageclient, vscode-ws-jsonrpc, monaco-editor-wrapper, @typefox/monaco-editor-react and monaco-languageclient-examples
https://www.npmjs.com/package/monaco-languageclient
MIT License
992 stars 171 forks source link

Update code configuration. languageId is no longer required. #650

Closed kaisalmen closed 1 month ago

kaisalmen commented 2 months ago

Re-work how to configure code in UserConfig and make languageId no longer required and do not enforce it in the editor model. This is now uri or file extension driven. languageId can be optionally enforced (WA for classical editor in the wrapper).

It is now possible to create an editor without any text or model and update the model or codeResources later. This is demonstrated here: https://github.com/TypeFox/monaco-languageclient/blob/issue-639/packages/examples/src/langium/statemachine/main.ts#L28-L42

Fixes #639

kaisalmen commented 1 month ago

@CGNonofr are the API changes still ok for a minor version change? WDYT?

CGNonofr commented 1 month ago

@CGNonofr are the API changes still ok for a minor version change? WDYT?

We should keep it simple:

Is it backward compatible ?

kaisalmen commented 1 month ago

Is it backward compatible ?

The UserConfig is not. So, if you do it by the book it is a major version change. But the change is for the good, because what I did previously was too limiting.

kaisalmen commented 1 month ago

@CGNonofr I should add a couple of unit tests for this and I think the new version of wrapper and react comp should be major ones. Do you think this configuration approach for code text / model handling is an improvement?

kaisalmen commented 1 month ago

@CGNonofr this is ready for review now. Version changes and CHANGELOG adjustments will come later (not be part of this PR)

kaisalmen commented 1 month ago

@CGNonofr I just released the new versions on npm. I cleaned-up examples and did some further API alignments directly on main as I realised I missed something. monaco-languageclient is a minor change (8.4.0). The wrapper advanced to v5 and the react component advanced to v4.