Posted 15 years ago by Marianne
Avatar
First of all, just want to say this is quite an upgrade! Am still sifting through all the changes and so far, everything is exceeding expectations!

This is a question that I was asked to hold onto until the release of 2.0. So here it is again...

What would be the easiest way to add keywords to a given language without having these changes updated when executing SaveToXml()?

Basically, I just want to provide highlighting for VB variables that have been dimmed--and needless to say, these are not things that should be saved between sessions.

Thanks, and again, great job!

------------------------------- Marianne

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We're glad you like the new version. A lot of hard work went into it!

We need to add a couple more methods to support the dynamic keywords. Right now you can add pattern groups to a language using an Add method however the order in which pattern groups are defined does matter. For instance, your keywords pattern group should appear before the Identifier pattern group. By using the Add method, you would be adding the pattern group however it would be added after the Identifier pattern group.

So in summary we need to add an Insert method. We also need to add Remove and Clear methods to some of the language objects. We will add those for the next release, possibly this weekend.

After those are added, you'll be able to completely modify pattern groups and patterns at run-time.


Actipro Software Support

Posted 15 years ago by Marianne
Avatar
That's great! The Add method, though, will actually add the pattern group to the language so that when the language is saved to xml, it will be persisted. To make these changes transitory, I could either call Remove on the same pattern group that I created programmatically, -or- would it be possible to add another attribute to the patterngroups like Temporary="True"?

The only problem I see with calling Remove() prior to saving the language data to xml is that if someone uses the StyleEditorForm to modify a style (that's the point at which I update the xml) then I'll have to remove those temporary pattern groups prior to saving. In so doing, the active script will then lose those patterns.

Would you suggest loading a "template" language outside of any editor, and use that one to update the styles? Since it's not loaded into an editor, it won't contain any of the temporary pattern groups.

------------------------------- Marianne

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Marianne,

You are exactly on. When you go to save the XML, you could simply remove the pattern group what contains your dynamic keywords however maintain a reference to it. Then after you save the language, add it back in at the appropriate spot. Of course you need the next maintenance release to do this.

Or my other idea that I was going to say is what you wrote in your last paragraph where for the highlighting style window, just load the original file from disk, and save it back out. That way you don't even deal with the dynamic patterns.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 9 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.