What I managed to pull off this week:
- Implemented the support for global variables, that includes the store where they are saved, the methods by which they are accessed and the view which is right now in the preferences window, but as jhs said, I should probably move it to the Snippets Editor. And I will, once I will make the Snippets Editor :-), but for now it will stay there.
- Implemented the part of the insertion which can be done at this point. That includes:
- Insertion at the cursor position in the document.
- Indentation detecting and adjusting the snippet content for that.
- Evaluating the global variables.
- Replacing all the variables with their default value in the snippet content (if they are not global, or if they are global, but the database doesn't hold a value for that global variable).
- Made a hackergotchi and should be updated when daniel will have enough time (actually to be fair, I found a hackergotchi with me in my inbox in a morning a few days ago, done by a friend of mine and I just adjusted it a bit).
Here you can see a screenshot with the result at this point:
As you can notice, the view in the preferences window let's you see and modify the global variables. Actually, the first 3 columns are editable (the last one is just the result of the variable at that point), but only if the global variable is not marked as internal (which means it also can't be deleted). The internal variables aren't even saved in a XML file like the other ones, they are just instant evaluations in a function.
Also, I inserted there a snippet (the first one in the XML file where the snippets are saved). Since I haven't done the interaction layer with the user, I just listened to some event to insert it. If you look carefully, you can see the global variables are evaluated and it takes care of indentation (On the first line I inserted a space before inserting the snippet).
What I will do next week I don't know exactly, but I have a list of things I should do for the next 2 weeks (actually I hope to be done faster with them, but it depends on how much time I will need for the rest of my exams, since I have 3 exams in these 2 weeks), after which I will start making the Snippets Browser and Snippets Editor:
- Define the 2 functions used to save the XML files (this shouldn't last too long now, I lost a lot of time with the parsing of the XML files because I had to study a bit the libxml).
- Properly free the memory of the snippets database (though the memory for the snippet and snippets-group objects is free'd properly right now, so don't have that much to do here).
- Write some methods which weren't that important until this point (these should be just a few).
- Review my code until this point and see if I can optimize some things and make sure all the memory is free'd properly.
- Make the database know about the language of the current document and if the Snippets Manager has the option to show only the snippets for the language of the current document, then the iterator for the tree model should skip those snippets which are not relevant.
- Make the trigger-key based insertion.
- Convert the current macros in the Macro plugin to snippets for my plugin.
- Modify the IAnjutaSnippetsManager interface and if jhs agrees push my plugin to master and replace the current Macro plugin.
If you don't have time to look up where my source code is saved, you can view it here.
See you guys next week :-).
0 comments:
Post a Comment