I worked a little bit on the plugin, and I can provide some kind of user manual here :
0 - How can I get it
You can clone my repository :https://github.com/jfouche/codelite, and checkout the LUA_SCRIPT branch. You can also add a remote on my repository, and fetch it, if you already have a repository which fetch Eran's one. For the moment, it only works on Windows as I don't have linux or mac machines. You can compile codelite, as the wiki explains it : http://codelite.org/Developers/Windows
1 - How to manage the scripts
You can see a script tab on the workspace view. On this tab, you have 4 commands
* Add script : use it to add a script to codelite. This script will be available on the script list under the toolbar.
* Run script : to run the selected script. You can also run a script by double clicking on the script item in the list.
* Edit script : you can edit a script by clicking on the button. While it's modified, you just have to save it, it will be updated, and ready to run with the new script content.
* Delete script : well, if you don't need a script anymore
2 - Available API
Codelite API is availble through the cl_manager variable, and here are the current implemented methods
* IManager:GetActiveEditor() : return the current editor, or nil
* IManager:NewEditor() : return a new editor. It will create an new "untitled" editor.
* IManager:GetWorkspace() : return the workspace, or nil if none is open
* IEditor:GetEditorText() : return the whole editor content
* IEditor:SetEditorText(string) : replace the editor content with the provided string
* IEditor:GetSelection() : return the current selection
* IEditor:ReplaceSelection(string) : replace the current selection with the provided string
* IEditor:AppendText(string) : append string at the end of the editor
* Workspace:GetActiveProjectName() : return the name of the active project
* Workspace:GetProjectList() : return a list of project names
* Workspace:FindProjectByName(string) : return the project named by the provided string, or nil
* Project:GetName() : return the name of the project
* Project:GetFiles() : return a list of project files, with absolute path
3 - A sample, please...
ok, here is one which comment the current selection if any (comment.lua) :
Code: Select all
editor = cl_manager:GetActiveEditor()
if editor then
sel = editor:GetSelection()
if #sel ~= 0 then
text = "/* " .. sel .. " */"
editor:ReplaceSelection(text)
end
end
Enjoy