The attached files in the directories below provide partial support in CodeLite-2 (starting from 2.0.3365) for cobra language development.
What is supported
- Syntax colorization
- Project Templates for debug, release and turbo builds of
- Console: Simple cobra executable (single file)
- User Templates: cobra executable
- User Templates: cobra library
- User Templates: cobra executable with embedded runtime
- cobra builds, build error capture and parsing.
- Running the executable made
- Some elements of tags-like/cscope capability
- See Note below
What is not supported (yet)
- Code structure browser (Outline)
- word and call completion (intellisense)
- Installed version of the cobra compiler installation.
Specifically you will need to know the path to the compiler executable cobra.exe
- gzipped tar dearchiver (gzip, gnu tar, 7-zip, winRar)
- if obtained this file in a tar archive
- Download an installation binary for CodeLite version 2.0 from the CodeLite website.
- Install it and take note of the installation directory
- If necessary for each text file below this directory modify
line endings to conform to those of the platform you are running on.
( see the le program in cobra compiler source ./Supplements/le.cobra)
Currently these are multiple files under three directories that are intended to be copied into the CodeLite installation.
cd <this dir> cp -pr config/* /wbin/CodeLite/config/ cp -pr lexers/* /wbin/CodeLite/lexers/ cp -pr templates/* /wbin/CodeLite/templates/
- All of the files are additional to the default CodeLite installation except for files in config. These copies replace the existing files in the installed config directory (they should be a superset). If you are feeling paranoid you might want to backup the CodeLite installation originals before the copy.
Alternatively the file ./00-config.patch has the mods to the config directory files as a patch file against a 2.0.3365 installation. If you run the patch program against the patch file you can attempt to patch the CodeLite installation files in place.cd <this dir> patch -p0 -i ./00-config.patch
Note that you'll need to have patch installed and you may have problems with version skew if the installation files change.
The patch file assumes the CodeLite Installation is in /Program\ Files/CodeLite - if thats not the case you will need to change all occurrences of that path to your installation dir before running the patch.... Luck
- Start CodeLite - select menubar 'Settings' item 'BuildSettings'. In the popup dialog that appears you should see a box on the left hand side containing a possibly expanded entry for Cobra.
- You now need to tell CodeLite the path to the cobra compiler.
o In the above dialog (menubar 'Settings'/'Build Settings...' under the cobra Tree entry click on 'Tools'.
The RHS of the dialog will show a form the top line of which has an entry similar to 'Compiler Name: C:\some\path\to\cobra.exe'.
Change the path to that of your cobra compiler (fwd or back slashes are equally recognised).
Press 'OK' btn to save the change.
o Select from MenuBar menu 'Settings'/'Environment Variables...'. edit the 'cobrac' entry to specify the full path to the cobra compiler and save your changes.
Installation Tested on Windows (XP-pro SP3).
- Workspace/New? Project
Select type of cobra project from cobra templates supplied:Console/Simple Executable(Cobra) or User Templates/Cobra-executable /Cobra-library /Cobra-embedded-RT
and enter the project name and path to your project directory and press OK.
- In the generated project tree select the project name and add (for existing) or create your cobra sources.
- You'll notice that where theres a Resources virtual dir made for a project theres a file 'build-file' which is a build-list file for the cobra compiler to use
(for apps that require multiple source files)
Unfortunately you currently have to maintain the contents of this yourself as we cant get hold of CodeLites sourcelist.
Just add filename entries to it as you add/create your source files.
CodeLite uses the Scintilla editing component which supports syntax colorization for a number of languages.
The Cobra configuration uses the python lexer for colorization currently which works for everything except cobras block commenting construct (/# ... #/) - we'll have to get a modified lexer to support that.
There are two colorization schemes available for cobra. The minimalist and install default one ('Cobra') is exactly the same as that for python.
I made a modified one for my preference which is called 'CobraAlt'.
If you would like to enable it use the menuBar 'Settings/SyntaxHighlight? and Fonts..' to get to the Syntax Highlight dialog.
You'll notice the settings for the Cobra scheme specify a file mask of '*.cobra' while that for CobraAlt specifies '*.cobra-A'. To enable the alt scheme you will need to swap these:
i.e change the Cobra scheme filemask to something else (*.cobra00 say) and the CobraAlt scheme filemask to the std cobra extension (*.cobra)
- CodeLite/Scintilla doesnt seem to handle multiple schemes with the same file mask.
After that you'll need to reload the workspace to get the color changes (menuBar 'Workspace/ReloadWorkspace?').
CodeLite supports ctags and cscope for file navigation - currently the inbuilt tagger seems tied to C/C++. However You can get this to work in some fashion either by using ctags ( exuberant ctags) manually or adding an 'external tool' setup to CodeLite to run it. (In either case you'll need to get and install the ctags binary)
The file ../ctags/home.ctags in this tree provides minimal support for recognising and tagging .cobra files.
Take it and install it in your home directory as .ctags (i.e $HOME/.ctags).
Now you should be able to make a tags file for your cobra sources by running 'ctags -R *.cobra'.
Copy the generated 'tags' file into your codeLite workspace file overwriting (the empty) tags file thats there.
(There are settings in CodeLite - 'tags settings' - to do this but the dialog is currently wired to forcing C/C++ files which has the effect of generating an empty tags file for cobra sources which doesnt do us much good).
Within codelite the 'Find this C symbol' and 'Find this global symbol' then provide results, the caller/callee searches dont return anything
The wired buttons (TODO/FIXME/ATTN/...) and search doesnt work for cobra as is.
Modify the task entry line to search 'all files' rather than C/C++ files.
You then need to use the 'Customize' button to bring up a customized search dialog;
modify the search pattern to look for a # comment prefix rather than '/*'
the pattern should be something like '#[ \t]*(TODO|FIXME|BUG|ATTN) *:*'
and change the 'Look in these filetypes' line to '*.cobra'
Search hits will display in the 'Find Results' Tab.