-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
monaco-editor and monaco-yaml together #17
Comments
I could not even integrate monaco-yaml with monaco, rest aside diff-editor. Have you ? |
no, my target is to add validation on monaco diff-editor , I was able to use you can get use of
|
Your implementation is impressive, I have done something similar for now in my application where I added a textarea on top of editor showing any parsing errors. so it takes minimal height. But @pengx17 has made a demo of inline validation using yaml-language-server. https://gautamits.github.io/json-schema/ . I am still finding it hard to integrate inline validation with all webpack bundling stuff. |
@gautamits yah I did the same when I could not add this feature. will keep it as enhancement for later on |
Sure @eftikharEmad . Please let me know if you make any progress. |
I got monaco-yaml working in monaco-editor. The thing I don't know how to get done is export it all so that it works in a release. Used information from these pages https://stackoverflow.com/questions/50606676/how-do-i-add-a-new-language-syntax-to-monaco-editor Open the destination folder in VS Code
Open ~/metadata.js in the root and add the references to the monaco-yaml project
Run it It works. Now this next part Is where I tried to get this to work in a release but I failed. If anyone can help me that would be nice :) Register it in the exports in ~/monaco-editor/ci/webpackcongfig.cs Next File: monaco-editor\node_modules\monaco-yaml\esm\yaml.worker.js File: monaco-editor\node_modules\monaco-yaml\esm\languageservice\parser\yamlParser04.js Build the release again In the folder ~/monaco-editor/release/min/vs/language the language (yaml in this case) is created. |
Hi @Monedula1 , just to add Your comment is very well written and easier to follow along. I repeated the steps you have mentioned and also published a release in which yaml language worker was loading, but somehow couldnt get it to validate syntax. Please let me know if you have made any progress regarding this or you need any help. |
@gautamits Thank you. And yes I would love for a monaco expert to help me find out what I missed. I think there is something missing in the build release that makes it not do syntax coloring yet. |
Hi @Monedula1 , Can you please upload the custom release you built ? |
@gautamits |
@Monedula1 thanks for hosting. I tried your release and it throws this error on console though |
@gautamits thanks for looking at it. I am a C# developer mostly so I don't know what I am still missing in my guide. The validation works if you edit yaml in the the testpage form monaco-editor. I found this thread: uiwjs/react-monacoeditor#1
Some yaml reference is not correct yet... I don't have much time to pursue this right now. I will definitely asap. |
Sure. Thanks. |
GOT IT WORKING! After including the min and min-maps folder from the release build (as described above) into the project the error I got was that monaco was not known. While loading the yaml library the javascript responsible for that piece needed the variable monaco to exist. After the page was done loading it did exist, but not at the moment it is put in the editor.main.js file. So I put the method into an async function that waits till monaco is known and then loads the yaml functionality. This is the code:
@gautamits does this work for you as well? |
It appears Monaco doesn’t support hover effects in readonly mode. By default the original code of the diff editor is readonly. I.e., try the following code in the playground: monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: [{
uri: 'http://myserver/schema.json',
fileMatch: ['a://*.json'],
schema: {
type: 'object',
properties: {
p1: {
enum: ['v1', 'v2']
},
p2: {
enum: ['x1', 'x2']
}
}
}
}]
});
const original = monaco.editor.createModel(`{
"p1": "v3"
}
`, 'json', monaco.Uri.parse('a://foo.json'));
const modified = monaco.editor.createModel(`{
"p2": false
}
`, 'json', monaco.Uri.parse('a://bar.json'));
const diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
originalEditable: false,
});
diffEditor.setModel({
original,
modified,
}); You’ll notice the original (left sie) doesn’t support hover tooltips, but the modified version (right side) does. If you set
|
does any one have any Idea how to add monaco-yaml to diff-editor
https://microsoft.github.io/monaco-editor/playground.html#creating-the-diffeditor-hello-diff-world
The text was updated successfully, but these errors were encountered: