mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Format sample code
This commit is contained in:
parent
c620a60f78
commit
65473735f8
2 changed files with 39 additions and 34 deletions
|
|
@ -41,35 +41,38 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
language: "json"
|
language: "json"
|
||||||
});
|
});
|
||||||
|
|
||||||
var commandId = editor.addCommand(0, function() {
|
var commandId = editor.addCommand(0, function () {
|
||||||
// services available in `ctx`
|
// services available in `ctx`
|
||||||
alert('my command is executing!');
|
alert('my command is executing!');
|
||||||
|
|
||||||
}, '');
|
}, '');
|
||||||
|
|
||||||
monaco.languages.registerCodeLensProvider('json', {
|
monaco.languages.registerCodeLensProvider('json', {
|
||||||
provideCodeLenses: function(model, token) {
|
provideCodeLenses: function (model, token) {
|
||||||
return [
|
return {
|
||||||
{
|
lenses: [
|
||||||
range: {
|
{
|
||||||
startLineNumber: 1,
|
range: {
|
||||||
startColumn: 1,
|
startLineNumber: 1,
|
||||||
endLineNumber: 2,
|
startColumn: 1,
|
||||||
endColumn: 1
|
endLineNumber: 2,
|
||||||
},
|
endColumn: 1
|
||||||
id: "First Line",
|
},
|
||||||
command: {
|
id: "First Line",
|
||||||
id: commandId,
|
command: {
|
||||||
title: "First Line"
|
id: commandId,
|
||||||
|
title: "First Line"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
];
|
};
|
||||||
},
|
},
|
||||||
resolveCodeLens: function(model, codeLens, token) {
|
resolveCodeLens: function (model, codeLens, token) {
|
||||||
return codeLens;
|
return codeLens;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------SAMPLE JS END*/
|
/*----------------------------------------SAMPLE JS END*/
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -3,31 +3,33 @@ var editor = monaco.editor.create(document.getElementById("container"), {
|
||||||
language: "json"
|
language: "json"
|
||||||
});
|
});
|
||||||
|
|
||||||
var commandId = editor.addCommand(0, function() {
|
var commandId = editor.addCommand(0, function () {
|
||||||
// services available in `ctx`
|
// services available in `ctx`
|
||||||
alert('my command is executing!');
|
alert('my command is executing!');
|
||||||
|
|
||||||
}, '');
|
}, '');
|
||||||
|
|
||||||
monaco.languages.registerCodeLensProvider('json', {
|
monaco.languages.registerCodeLensProvider('json', {
|
||||||
provideCodeLenses: function(model, token) {
|
provideCodeLenses: function (model, token) {
|
||||||
return {lenses: [
|
return {
|
||||||
{
|
lenses: [
|
||||||
range: {
|
{
|
||||||
startLineNumber: 1,
|
range: {
|
||||||
startColumn: 1,
|
startLineNumber: 1,
|
||||||
endLineNumber: 2,
|
startColumn: 1,
|
||||||
endColumn: 1
|
endLineNumber: 2,
|
||||||
},
|
endColumn: 1
|
||||||
id: "First Line",
|
},
|
||||||
command: {
|
id: "First Line",
|
||||||
id: commandId,
|
command: {
|
||||||
title: "First Line"
|
id: commandId,
|
||||||
|
title: "First Line"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]};
|
};
|
||||||
},
|
},
|
||||||
resolveCodeLens: function(model, codeLens, token) {
|
resolveCodeLens: function (model, codeLens, token) {
|
||||||
return codeLens;
|
return codeLens;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue