I have examined the komodo edit files and come up with a possible solution to creating a CIX file for handlebarsjs using the extjs_to_cix.py as a template.
My idea is to use the extjs_to_cix.py file and edit it to download the handlebarsjs file and create a handlebars.cix file. My problem is that i’m not sure of what additional files or folders are needed in order to complete the task.
I have already used the komodo dev extension to create a language file for creating color highlighting.
Once i understand how this works i will create a tutorial so that others can benefit as well as an extension
Hi, that might work if handlebarsjs has “parseable” source code that Komodo’s code intelligence routines can understand.
You’ll have to download KomodoEdit’s “src/codeintel” folder. If you’re on Linux, go to that folder in the terminal and then run source bin/setenv.sh to put the needed Python libraries in your PYTHONPATH. Then you can navigate to the “support/gencix/javascript/extjs” folder and start trying to generate cix files.
Generating cix catalogs is severely underdocumented and I’m still trying to understand it myself. I hope this helps.
@careyh yes i have already done this with the syntax coloring but what i’m after is creating a CIX file which is not part of the language extension/add-on. There are files in the komodo edit repo that will download a javascript file and create an API catalog or a CIX file for use with komodo’s codeintel.
@mitchell i have tried using the src/codeintel but it is so complex in the directory structure that i need some expert that can give me some pointers on how to create a CIX. In the Komodo edit repo there are a number of files like extjs_to_cix.py that the developers use to generate CIX files so why not see how it is done and create some instructions.
My intention is to work out what is required in creating a CIX file and document my findings in the online documents so that others can follow.
I can only give you some pointers based on work I recently did to generate CIX catalogs for Angular.js and Ember.js.
The first thing you need to do is figure out how you’re going to parse handlebarsjs files. I am not familiar with it so I can’t help there. If they are using yuidoc to document their JS classes, methods, etc. then you may be able to modify the “src/codeintel/support/gencix/javascript/ember/ember_json_to_cix.py” script to suit your needs. AngularJS does not play nice with yuidoc (or any other documentation generator other than their horrendously ill-documented in-house one), so I had to create my own parser to read their comment tags.
Whichever way you end up going, the first thing you need to do is run “source bin/setenv.sh” from the “src/codeintel” directory. This will load codeintel’s CIX generator Python libraries into your PYTHONPATH.
Once you do that, you can cd into “src/codeintel/support/gencix/javascript/angular” or “src/codeintel/support/gencix/javascript/ember” and use python to run either .py file. That will generate angular and ember cix files for your reference.
If you want to write your own CIX generator from scratch, you basically need to create the following:
CIX root via Python createCixRoot() - this is the toplevel XML declaration of the catalog.
CIX file via createCixFile() - this is the tag that contains all of your classes, functions, etc. for your framework.
CIX module via createCixModule() - this is also a tag that contains all of your classes, functions, etc.
Each namespace/class will be added to your CIX module object.
Each function will be added to either your CIX module object (for global functions) or any namespace/class CIX objects you create.
Documentation can be attached to namespaces, classes, and functions via setCixDoc().
I know this is a lot of information to take in, but have a look at the angular and ember CIX generators. They should make some level of sense (probably more than the others, which I found to be haphazard and poorly documented).
Hi, sorry for the trouble. In “src/codeintel/config.py” go to the end of the file and there’s a line that starts with “PYTHON_SCHEME = ‘komodo’”. Change that to “PYTHON_SCHEME = ‘first-on-path’” and try again.