SyntaxEditor 2 Issues

SyntaxEditor for Windows Forms Forum

Posted 20 years ago by painetraine
Avatar
Well, I am trying to convert from v1 to v2 of SyntaxEditor and I have a couple of issues right now.

1. I had this same issue with v1 of the editor. If you have a state such as follows (any state will do) (this is a child state of the default state in sql language)

<State Key="UseState" Token="UseDefaultToken" Style="ReservedWordStyle">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" Token="UseStartToken" Style="ReservedWordStyle" PatternValue="[Uu][Ss][Ee]"/>
<RegexPatternGroup Type="EndScope" Token="UseEndToken" Style="DefaultStyle" PatternValue="[\w\s]"/>
</Scope>
</Scopes>

<PatternGroups>
<RegexPatternGroup Token="UseDefaultToken" PatternValue="\s" />
</PatternGroups>
</State>

and go to the end of the document and type "use" (so it should match the above state), the document never goes into the UseState. If you move to the next to the last character in the document, and type "use" then the editor will switch to the correct state (I am using the testeditor to test my states change correctly).

2. This one is a biggie since it causes the SyntaxEditor control to begin grabbing memory (when I checked it, the TestApp was up to 500MB and using 100% of the processor)

In v1 I had the following expressions:

<Regex Value="[Dd][Bb][Cc][Cc]" Token="DBCCStartToken">
<RegexValidStates>
<RegexValidState State="DefaultState" />
</RegexValidStates>
</Regex>
<Regex Value="[ ]+" Token="DBCCDefaultToken">
<RegexValidStates>
<RegexValidState State="DBCCState" />
</RegexValidStates>
</Regex>
<Regex Value="{LineTerminatorMacro}" Token="DBCCEndToken">
<RegexValidStates>
<RegexValidState State="DBCCState" />
</RegexValidStates>
</Regex>

<Regex Value="{WordMacro}" Token="DBCCProcStartToken">
<RegexValidStates>
<RegexValidState State="DBCCState" />
</RegexValidStates>
</Regex>
<Regex Value="\w*" Token="DBCCProcDefaultToken">
<RegexValidStates>
<RegexValidState State="DBCCProcState" />
</RegexValidStates>
</Regex>
<Regex Value="{LineTerminatorMacro}" Token="DBCCProcEndToken">
<RegexValidStates>
<RegexValidState State="DBCCProcState" />
</RegexValidStates>
</Regex>

In v2, I added the following states to the SQL language file you provide:

<State Key="DBCCState" Token="DBCCDefaultToken" Style="ReservedWordStyle">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" Token="DBCCStartToken" Style="ReservedWordStyle" PatternValue="[Dd][Bb][Cc][Cc]"/>
<RegexPatternGroup Type="EndScope" Token="DBCCEndToken" Style="DefaultStyle" PatternValue="{LineTerminatorMacro}"/>
</Scope>
</Scopes>

<PatternGroups>
<RegexPatternGroup Token="DBCCDefaultToken" PatternValue="[ ]+" />
</PatternGroups>

<ChildStates>
<ChildState Key="DBCCProcState"/>
</ChildStates>
</State>

<State Key="DBCCProcState" Token="DBCCProcDefaultToken" Style="ReservedWordStyle">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" Token="DBCCProcStartToken" Style="ReservedWordStyle" PatternValue="{WordMacro}"/>
<RegexPatternGroup Type="EndScope" Token="DBCCProcEndToken" Style="DefaultStyle" PatternValue="{LineTerminatorMacro}"/>
</Scope>
</Scopes>

<PatternGroups>
<RegexPatternGroup Token="DBCCProcDefaultToken" PatternValue="\w*" />
</PatternGroups>
</State>

In this example, I can type "dbcc" ok and it goes into DBCCState, however I then type any number of spaces and everything is ok, but when I try to type any other character, the control begins eating memory and processor and never comes back. In v1, the top language def worked by going into dbcc state and then when the user typed anything else, it would go into dbccprocstate and stay there until the next line. (Note: DBCCState above is a child of DefaultState)

Maybe I have just defined it wrong for the new language definition so if you could let me know if this is maybe an error in me defining the language elements (very possible) I would greatly appreciate it since I want to convert to SyntaxEditor 2.0 for my app for many of the other features.


Thanks

Comments (5)

Posted 20 years ago by painetraine
Avatar
Ok, I figured out it was my own problem. The DefaultTokens don't like anything of the form ...*, ie \s* or \w* since I added some other items that this caused the same error.

However, I do have another question. I added Begin/End as collapsable nodes and they do collapse, but on a big file that I have when begin and end wrap many other begin..ends, the collapsing eventually gives up and ends at the wrong "end". Is there a limit to the size of the collapsing?

Thanks
Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The begin and ends should work correctly even in large documents. Do you mean that you have a lot of them or that they are nested many levels deep within each other?


Actipro Software Support

Posted 20 years ago by painetraine
Avatar
Yes, I see that I had a special case that is causing my outlining to end prematurely.

I think this fixes all my issues except for the first one that I mentioned where typing at the end of the document doesn't handle the states properly


Thanks
Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I'll add the first item to our TODO list to fix as soon as we can.


Actipro Software Support

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This is now fixed for the next release.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.