Displaying inactive code snippet sessions in split window

SyntaxEditor for WPF Forum

Posted 3 years ago by Xinen Lee
Version: 16.1.0633
Avatar

Hi Actipro,

Our current design is such that when we have a split window showing 2 views of the same document, each view is able to open its own (different) code snippet. We feel that it would be helpful to the user to have a visual indication of a code snippet session that is in an inactive view. Similar to line selection where in an inactive view, the line selection color becomes lighter, we would like to make it such that the orange code snippet fields can become lighter when the view becomes inactive. This way, the user will know which code snippet session a 'tab' key will affect.

Is this even possible in the first place? I am unable to find a way to override the current CodeSnippetField classification type's display style. Would Actipro be able to provide us with a way to implement this please?

 

Thanks

Xinen

Comments (7)

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

Hi Xinen,

If you set up a ICodeSnippetTemplateSessionEventSink, that gets notified when a template session opens/closes, a declaration is activated/deactivated, or text changes within a declaration.  By handling those event notifications, you could probably use a classification tagger for other views to mark the various declaration ranges.

Code snippet declaration ranges are tagged with the display item CodeSnippetField or CodeSnippetDependentField classification types.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro,

When I say active/inactive view I meant whether the whole view has focus, not whether individual declarations are activated. I don't see how ICodeSnippetTemplateSessionEventSink helps as I don't need those notifications. Whenever I create a code snippet it would be in an active view and I should be able to use the default Actipro implementation. It is only when I change the active view while the code snippet session is open, that I need to make the changes.

For example we use a splitter and there' s a top and bottom view showing the same document. I open a "if" code snippet on top, and a "for" code snippet at the bottom. When my focus is on the bottom view I want the top "if" code snippet's fields to become light orange, just like how a selection becomes light blue when the view is inactive/no longer in focus.

So if a code snippet declaration range is tagged with CodeSnippetField, and will always be dark orange, what can I do to make it become light orange when its view becomes inactive? At any time I may have 1 active view with dark orange CodeSnippetFields and multiple inactive views with light orange CodeSnippetFields present.

If I create a new (light orange) classification type CodeSnippetInactiveField, will I be able to replace the existing dark orange CodeSnippetFields when the view inactive, and replace it back when the view is active? What's the best way to do this?

[Modified 3 years ago]

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

Hi Xinen,

Ok, I thought you had meant you wanted to duplicate the code snippet fields in the inactive views but it is more that you want to dim the appearance of the fields of any code snippet fields started in currently-inactive views.

The IActiveEditorViewChangeEventSink tells you when the active view changes.  You could watch that and when you detect it, look to see if editor.IntelliPrompt.Sessions has any code snippet template sessions.  Each session has a View that says which view it's associated with.  If there is a template session active, then use a tag aggregator to get all the IClassificationTags in that view that have CodeSnippetField or CodeSnippetDependentField classification types.  Those are your ranges you would need to tag in that view only with a high priority tag of your own, and whose associated highlighting style would need to override the existing ones.  Taggers can set priority via the "orderings" passed in to the base CollectionTagger constructor.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

How do I set priority for my InactiveCodeSnippetFieldTagger over the CodeSnippetFieldTagger which is internal? What key should I use?

 

I'm only able to set priority over the Tokens (which is not what I want) using the following

new Ordering(TaggerKeys.Token, OrderPlacement.After)


I am also unable to specify ordering for the IClassificationType as OrderableClassificationType is also internal.

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

Hi Xinen,

The CodeSnippetFieldTagger uses a "CodeSnippetFieldTagger" key, so you can order against that.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro,

To clarify, even if I have a Ordering before the "CodeSnippetFieldTagger", the CodeSnippetFieldTagger's bright orange will still be displayed under my InactiveCodeSnippetFieldTagger's color. Is this right?

I found that I can't just use the same bright orange with a lower alpha value for the inactive tagger, as the bright orange will still be displayed through under my translucent orange. I had to use an opaque light orange to cover over the CodeSnippetFieldTagger's color.

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

Hi Xinen,

That is correct, you need to use a solid color because otherwise, the other background highlight will show through.  We allow layering of highlighted ranges.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.