AudoEditStrategy with context? [message #1047184] |
Mon, 22 April 2013 22:30 |
Brad Riching Messages: 20 Registered: May 2012 |
Junior Member |
|
|
Greetings everyone.
Does anyone know how I would go about implementing an AutoEditStrategy only in certain places of my model? The IAutoEditStrategy#customizeDocumentCommand only has an IDocument and DocumentCommand accessible, and no information or context about where I am in the model.
I would like to be able to take a list of items on a line like this:
containerName { item1, item2, item3, item4 }
And with each press of the [ENTER] button anywhere inside the brackets, I would like my AutoEditStrategy to insert a backslash indicating to my (external) compiler that the line has wrapped, like this:
containerName {\
item1,\
item2,\
item3,\
item4\
}
The key is, that the backslash should only be inserted if [ENTER] is pressed inside of the brackets. It should not insert a backslash outside the scope of the container.
Any ideas?
|
|
|
Re: AudoEditStrategy with context? [message #1047259 is a reply to message #1047184] |
Tue, 23 April 2013 01:24 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 2013-23-04 24:30, Brad Riching wrote:
> Greetings everyone.
>
> Does anyone know how I would go about implementing an AutoEditStrategy
> only in certain places of my model? The
> IAutoEditStrategy#customizeDocumentCommand only has an IDocument and
> DocumentCommand accessible, and no information or context about where I
> am in the model.
>
> I would like to be able to take a list of items on a line like this:
>
>
> containerName { item1, item2, item3, item4 }
>
>
> And with each press of the [ENTER] button anywhere inside the brackets,
> I would like my AutoEditStrategy to insert a backslash indicating to my
> (external) compiler that the line has wrapped, like this:
>
>
> containerName {\
> item1,\
> item2,\
> item3,\
> item4\
> }
>
>
> The key is, that the backslash should only be inserted if [ENTER] is
> pressed inside of the brackets. It should not insert a backslash
> outside the scope of the container.
>
> Any ideas?
IIRC the auto edit is tied to regions in the text (i.e. inside strings,
comments etc.), but I don't remember exactly how. Think you need to read
the source for auto edits to figure it out.
Regards
- henrik
|
|
|
|
Powered by
FUDForum. Page generated in 0.01616 seconds