Opening file in cloud9 using external link


I’m curious if there is any existing way to open a file for editing using external link? E.g. I’m opening some link like and it would open for editing /path/to/file at line 42. Or at least just file itself.

If not… I know that your SDK allows to open new tabs. Can it read URL params? And is there any way to scroll to the exact line?



welcome.js plugin does something similar by opening preview at the startup
and the link_handler.js has a function to parse and open urls in the form /path/to/file:5:10


Thanks to my colleague, we have this snippet that should be put to Init script (Cloud9 > Open Your Init Script):

function openEditorTab () {
    if (window.location.hash.match(/#editfile-(.*):([0-9]+)/)) {
        var file = "/" + RegExp.$1;
        var line = RegExp.$2;
        services.fs.exists(file, function(exists) {
            if (!exists) return;
            services.tabManager.openFile(file, true, function(err, tab) {
                var editor = tab.editor;
                editor.ace.gotoLine(line, 0, true);

window.addEventListener("hashchange", openEditorTab, false);

Now to open a certain file at certain line you just need to call:'', 'c9win');