nadesiko3
Version:
Japanese Programming Language
1 lines • 3.71 kB
JavaScript
define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"],function(e,l,n){"use strict";function o(e,n){if(e&n.CHANGE_LINES||e&n.CHANGE_FULL||e&n.CHANGE_SCROLL||e&n.CHANGE_TEXT){var o=n.session,t=n.session.lineWidgets,r=n.$textLayer,i=r.$lenses;if(t){for(var s,a,d=n.$textLayer.$lines.cells,l=n.layerConfig,c=n.$padding,i=i||(r.$lenses=[]),u=0,f=0;f<d.length;f++){var g=d[f].row,L=t[g],p=L&&L.lenses;if(p&&p.length){var v=i[u];(v=v||(i[u]=x.buildDom(["div",{class:"ace_codeLens"}],n.container))).style.height=l.lineHeight+"px",u++;for(var h=0;h<p.length;h++){var m=v.childNodes[2*h];m||(0!=h&&v.appendChild(x.createTextNode(" | ")),m=x.buildDom(["a"],v)),m.textContent=p[h].title,m.lensCommand=p[h]}for(;v.childNodes.length>2*h-1;)v.lastChild.remove();var $=n.$cursorLayer.getPixelPosition({row:g,column:0},!0).top-l.lineHeight*L.rowsAbove-l.offset;v.style.top=$+"px";var C=n.gutterWidth,w=o.getLine(g).search(/\S|$/);-1==w&&(w=0),C+=w*l.characterWidth,C-=n.scrollLeft,v.style.paddingLeft=c+C+"px"}}for(;u<i.length;)i.pop().remove()}else i&&(s=n.$textLayer,(a=s.$lenses)&&a.forEach(function(e){e.remove()}),s.$lenses=null)}}function t(d){d.codeLensProviders=[],d.renderer.on("afterRender",o),d.$codeLensClickHandler||(d.$codeLensClickHandler=function(e){var n=e.target.lensCommand;n&&d.execCommand(n.id,n.arguments)},i.addListener(d.container,"click",d.$codeLensClickHandler,d)),d.$updateLenses=function(){var o,s,a=d.session;a&&(a.widgetManager||(a.widgetManager=new r(a),a.widgetManager.attach(d)),o=d.codeLensProviders.length,s=[],d.codeLensProviders.forEach(function(e){e.provideCodeLenses(a,function(e,n){e||(n.forEach(function(e){s.push(e)}),0==--o&&function(){var e=a.selection.cursor,n=a.documentToScreenRow(e);l.setLenses(a,s);var o,t,r,i=a.$undoManager&&a.$undoManager.$lastDelta;i&&"remove"==i.action&&1<i.lines.length||(o=a.documentToScreenRow(e),t=d.renderer.layerConfig.lineHeight,r=a.getScrollTop()+(o-n)*t,a.setScrollTop(r))}())})}))};var e=s.delayedCall(d.$updateLenses);d.$updateLensesOnInput=function(){e.delay(250)},d.on("input",d.$updateLensesOnInput)}var r=e("../line_widgets").LineWidgets,i=e("../lib/event"),s=e("../lib/lang"),x=e("../lib/dom");l.setLenses=function(r,e){var n,o,i=Number.MAX_VALUE;(n=r).lineWidgets&&(o=n.widgetManager,n.lineWidgets.forEach(function(e){e&&e.lenses&&o.removeLineWidget(e)})),e&&e.forEach(function(e){var n=e.start.row,o=e.start.column,t=r.lineWidgets&&r.lineWidgets[n];t&&t.lenses||(t=r.widgetManager.$registerLineWidget({rowCount:1,rowsAbove:1,row:n,column:o,lenses:[]})),t.lenses.push(e.command),n<i&&(i=n)}),r._emit("changeFold",{data:{start:{row:i}}})},l.registerCodeLensProvider=function(e,n){e.setOption("enableCodeLens",!0),e.codeLensProviders.push(n),e.$updateLensesOnInput()},l.clear=function(e){l.setLenses(e,null)};var a=e("../editor").Editor;e("../config").defineOptions(a.prototype,"editor",{enableCodeLens:{set:function(e){var n;e?t(this):((n=this).off("input",n.$updateLensesOnInput),n.renderer.off("afterRender",o),n.$codeLensClickHandler&&n.container.removeEventListener("click",n.$codeLensClickHandler))}}}),x.importCssString(".ace_codeLens { position: absolute; color: #aaa; font-size: 88%; background: inherit; width: 100%; display: flex; align-items: flex-end; pointer-events: none;}.ace_codeLens > a { cursor: pointer; pointer-events: auto;}.ace_codeLens > a:hover { color: #0000ff; text-decoration: underline;}.ace_dark > .ace_codeLens > a:hover { color: #4e94ce;}","")}),window.require(["ace/ext/code_lens"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});