Disable $schema JSON autocompletion with Monaco

百般思念 提交于 2021-01-29 10:36:07

问题


I'm using the Monaco editor to build a JSON editing UI.

It seems if you use any Monaco setup for JSON (e.g. their home page demo, if you set it to JSON: https://microsoft.github.io/monaco-editor) then autocompletion (ctrl-space) always shows a $schema option.

I'm sure this is useful if you're intending to use JSON schemas, but I'm not. I want to implement my own autocompletion, so I don't want to disable it entirely, but I want to remove $schema from the options.

Adding a completionProvider seems to only add additional completions, not remove existing ones.

Is there any way to control this behaviour?


回答1:


In your package.json, you should depend on monaco-editor-core instead of monaco-editor. This way you won't get any of the JSON language editing capabilities. I think you'd have to define the syntax highlighting yourself though...



来源:https://stackoverflow.com/questions/50191131/disable-schema-json-autocompletion-with-monaco

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!