microsoft / microsoft/monaco-editor
[Feature Request] Documentation around registering custom languages with custom lsps
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Context
- This issue is not a bug report. (please use a different template for reporting a bug)
- This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
I am attempting to register a custom language in monaco which uses its own web worker and lsp. I see in the code and in issues like this one : https://github.com/microsoft/monaco-editor-webpack-plugin/issues/135#issuecomment-760288662 that it can be done, but there is little to no documentation on what exactly is needed, nor how to inform monaco of the newly created workers.
At present, I have a WorkerManager which is created in the onLanguage event for my language. This manager uses the getClientProxy method to load a new worker, which in turn listens for a message before creating an instance of my worker class.
However, this still does not seem to inform monaco of the worker. I tried providing monarch with a DocumentFormattingEditProvider similar to how it is done in https://github.com/amazzalel-habib/TodoLangEditor/blob/master/src/todo-lang/setup.ts, but nothing happens when I try to format code in an editor set to my language.
I see in the last example I linked that it is using the MonacoEnvrionment provider to load the todolang worker, but similar to @dkozar in the first link, I am never seeing that method fire for custom languages.
Any documentation on this process would be a huge help, thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the onLanguage event, WorkerManager, getClientProxy, MonacoEnvironment provider, and DocumentFormattingEditProvider described in the issue, comparing the linked TodoLangEditor example. Done means documenting the steps needed to register a custom language, load its worker and LSP, and enable formatting, including how Monaco is informed about the worker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100