123 |
- // This is a generated file. Please do not edit directly.
- var SAMPLES = this.SAMPLES || [];
- SAMPLES.push({"id":"extending-language-services-hover-provider-example","js":"//---------------------------------------------------\n// Extending Language Services > Hover provider example\n//---------------------------------------------------\n\nvar quoteOfTheDay = new monaco.Promise(function(c,e) {\n\twindow.parseResponse = function(rawQOD) {\n\t\tc(rawQOD.data.contents.quotes[0].quote);\n\t}\n\tvar script = document.createElement('script');\n\tscript.src='http://quotes.rest/qod.js';\n\tdocument.head.appendChild(script);\n});\n\nmonaco.languages.register({ id: 'mySpecialLanguage' });\n\nmonaco.languages.registerHoverProvider('mySpecialLanguage', {\n\tprovideHover: function(model, position) {\n\t\treturn quoteOfTheDay.then(function(quoteText) {\n\t\t\treturn {\n\t\t\t\trange: new monaco.Range(1, 1, model.getLineCount(), model.getLineMaxColumn(model.getLineCount())),\n\t\t\t\tcontents: ['**' + quoteText + '**']\n\t\t\t}\n\t\t});\n\t}\n});\n\nmonaco.editor.create(document.getElementById(\"container\"), {\n\tvalue: '\\n\\nHover over this text',\n\tlanguage: 'mySpecialLanguage'\n});\n","html":"<div id=\"container\" style=\"height:100%;\"></div>\n","css":""});
|