How to use the ext/editors/editors.currentEditor function in ext

To help you get started, we’ve selected a few ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylonide / pylon / plugins-client / ext.debugger / debugger.js View on Github external
showDebugFile : function(scriptId, row, column, text) {
        var file = fs.model.queryNode("//file[@scriptid='" + scriptId + "']");

        // check prerequisites
        if (editors.currentEditor && !editors.currentEditor.amlEditor.$updateMarkerPrerequisite()) {
            return;
        }

        if (file) {
            editors.jump(file, row, column, text, null, true);
        }
        else {
            var script = mdlDbgSources.queryNode("//file[@scriptid='" + scriptId + "']");
            if (!script)
                return;

            var name = script.getAttribute("scriptname");
            var value = name.split("/").pop();

            if (name.indexOf(ide.workspaceDir) === 0) {
                var path = ide.davPrefix + name.slice(ide.workspaceDir.length);
github pylonide / pylon / plugins-client / ext.language / quickfix.js View on Github external
getAnnos: function(row){
        var editor = editors.currentEditor.amlEditor.$editor;
        var res = [];
        
        editor.getSession().languageAnnos.forEach(function(anno, idx){
            if (anno.row == row){
                res.push(anno);
                
                /* Select the annotation in the editor */
                anno.select = function(){
                    if (!(anno.pos.sl && anno.pos.sc && anno.pos.el && anno.pos.ec)){
                        return;
                    }
                    var startPos = { row: anno.pos.sl, column: anno.pos.sc };
                    var endPos = { row: anno.pos.el, column: anno.pos.ec };
                    if (startPos.row < endPos.row || startPos.column < endPos.column){
                        editor.getSelection().setSelectionRange(
                            {start: startPos, end: endPos});
github pylonide / pylon / client / ext / gittools / gittools.js View on Github external
ide.dispatchEvent("track_action", {type: "gittools", cmd: this.command, subcommand: data.subcommand});
        if (ext.execCommand(this.command, data) !== false) {
            if (ide.dispatchEvent("consolecommand." + this.command, {
              data: data
            }) !== false) {
                if (!ide.onLine) {
                    util.alert(
                        "Currently Offline",
                        "Currently Offline",
                        "This operation could not be completed because you are offline."
                    );
                }
                else {
                    ide.send(JSON.stringify(data));
                    if (!this.originalGutterWidth)
                        this.originalGutterWidth = editors.currentEditor.amlEditor.$editor.renderer.getGutterWidth();

                    // Set gutter width, arbitrary number based on 12/13px font
                    editors.currentEditor.amlEditor.$editor.renderer.setGutterWidth("300px");
                }
            }
        }
    },
github pylonide / pylon / client / ext / language / language.js View on Github external
init : function() {
        var _self = this;
        var worker = this.worker;
        apf.importCssString(css);
        if (!editors.currentEditor || !editors.currentEditor.ceEditor)
            return;
        this.editor = editors.currentEditor.ceEditor.$editor;
        this.$onCursorChange = this.onCursorChangeDefer.bind(this);
        this.editor.selection.on("changeCursor", this.$onCursorChange);
        var oldSelection = this.editor.selection;
        this.setPath();

        this.setJSHint();
        this.setInstanceHighlight();
        this.setUnusedFunctionArgs();
        this.setUndeclaredVars();

        this.editor.on("changeSession", function(event) {
            // Time out a litle, to let the page path be updated
            setTimeout(function() {
                _self.setPath();
github pylonide / pylon / client / ext / gittools / gittools.js View on Github external
loadFileRevision : function() {
        var file = this.getFilePath();
        if (sliderGitLog.value == this.gitLogs[file].logData.length) {
            editors.currentEditor.amlEditor.getSession().setValue(
                this.gitLogs[file].currentRevision
            );
            editors.currentEditor.amlEditor.$editor.setReadOnly(false);
        } else {
            // Save the latest version of the file
            if (this.gitLogs[file].lastLoadedGitLog == this.gitLogs[file].logData.length)
                this.gitLogs[file].currentRevision = editors.currentEditor.amlEditor.getSession().getValue();

            this.gitShow(this.gitLogs[file].logData[sliderGitLog.value].commit);
        }

        this.gitLogs[file].lastLoadedGitLog = sliderGitLog.value;
        btnViewRevision.disable();
        btnGitBlame.enable();
    },
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
ide.addEventListener("correctactivepage", function(e) {
            var split = splits.getActive();
            var editor = editors.currentEditor && editors.currentEditor.amlEditor;
            if (!split || !editor)
                return;
            var idx = splits.indexOf(split, editor);
            if (idx == -1)
                return;
            e.returnValue = split.pairs[idx].page;
        });
github pylonide / pylon / plugins-client / ext.debugger / sources.js View on Github external
function updateMarker(frame) {
            var amlEditor = editors.currentEditor && editors.currentEditor.amlEditor;
            var session = amlEditor && amlEditor.$editor.session;
            if (!session)
                return;

            session.$stackMarker && removeMarker(session, "stack");
            session.$stepMarker && removeMarker(session, "step");

            if (frame) {
                var path = amlEditor.xmlRoot.getAttribute("path");
                var framePath = frame.getAttribute("scriptPath");
                var row = parseInt(frame.getAttribute("line"), 10);
                if (frame.hasAttribute("istop")) {
                    if (path == framePath)
                        addMarker(session, "step", row);
                }
                else {
github pylonide / pylon / plugins-client / ext.stripws / stripws.js View on Github external
var strip = module.exports.strip = function () {
    if (!editors.currentEditor.amlEditor)
        return;

    var editor = editors.currentEditor.amlEditor.$editor;
    var session = editor.getSession();

    var doc = session.getDocument();
    var lines = doc.getAllLines();

    for (var i = 0, l=lines.length; i < l; i++) {
        var line = lines[i];
        var index = line.search(/\s+$/);

        if (index !== -1)
            doc.removeInLine(i, index, line.length);
    }
    session.$syncInformUndoManager();
github pylonide / pylon / client / ext / acebugs / acebugs.js View on Github external
init: function(amlNode) {
        var currEditor = editors.currentEditor;
        if (currEditor) {
            this.editorSession = currEditor.ceEditor.getSession();

            this.editorSession.on("changeAnnotation", function(e) {
                _self.updateAnnotations();
            });
        }
    },
github pylonide / pylon / plugins-client / ext.vim / cli.js View on Github external
function getActiveEditor() {
    var amlEditor = editors.currentEditor.amlEditor;
    if (editors.currentEditor.path == "ext/code/code" && amlEditor)
        return amlEditor.$editor;
}