Use a plugin with Eclipse ORION without using the ORION server

601 views Asked by At

I am trying to get syntax highlighting in a web based editor and I can only use Eclipse ORION for that. ORION does not support syntax highlighting for the language I want so I wrote a plugin for that. The plugin is running perfectly in the ORION editor with the ORION server running.

Now I don't want to run the ORION server and want to embed the editor in my web site along with plugin. I am not able to figure out how to get the plugin working when using the client components of ORION (built-editor.js & built-editor.css).

I followed the instructions here: http://planetorion.org/news/2013/02/embed-the-latest-orion-editor-in-your-code-in-2-steps/ and was able to create an editor in a webpage but I couldn't figure out how to get plugin working. I couldn't even figure out if what I want to achieve is even possible.

Thanks in advance.

1

There are 1 answers

0
Stefan On

After some trial and error I got syntax highlighting working with config and initialization shown below.

For custom plugins also see

https://wiki.eclipse.org/Orion/How_Tos/Code_Edit#userPlugins_Parameter

 requirejs.config({                 
    baseUrl : '.',
    paths: {          
        'orion/editor': 'lib/orion',      
        'jquery': 'bower_components/jquery/dist/jquery.min'
    }
  }); 

-

require(['orion/editor/built-editor', 'orion/editor/stylers/application_javascript/syntax'], function(edit, syntax) {  

    var deferred = new $.Deferred();
    deferred.resolve(syntax);

    edit({
          className: "editor",
          lang:'js',
          grammarProvider: function(){                    
             return deferred.promise();                 
          }
   });
});