Type anything to escape from Code Snippet session

SyntaxEditor for WPF Forum

Posted 3 years ago by Xinen Lee
Version: 16.1.0633
Avatar

Hi Actipro

Currently we can only escape from a code snippet session by typing Tab, Enter or Escape. It could be frustrating for a user who does not know these 3 magic keys and is trying to exit from the session.

Is it possible to allow the user to exit just by typing anything outside the session? Visual Studio also allows for this, and it would be much more comfortable for users who try to click out of the session and can't figure out how to escape.

We don't have access to the session and cannot close it - will you be able to implement this behavior please?

Comments (13)

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

Hi Xinen,

Thanks for the suggestion.  That is a good idea and we'll add it for the next maintenance release.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Thanks!

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro, I've tried it on your test build and have a small suggestion - for Visual Studio, it exits from the code snippet session once we type outside the } ending close brace for the code snippet. For your build, it only exits when we type on a line after the last line of the code snippet. Would it be possible to exit once we type outside the code snippet region, i.e. right after the last character of the code snippet (e.g. })? and right before the first character, e.g. 'for' keyword.

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

Hi Xinen,

I just tested it in VS 2015 and our implementation of this works the exact same.  Both VS and SyntaxEditor allow typing at the first character (before the 'f' in 'for') and after the last character '}' without canceling the code snippet session.  If you type before the character before the 'f' or after the character after the '}' then both will cancel the session.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro,

I've been trying this on the test build and have some unexpected behavior when it comes to multiple views. I have multiple views of the same document. When I open a code snippet on View 1 and type on another View 2 in an area out of the code snippet text, the code snippet session in View 1 is closed. This is rather unexpected for the user as I would not expect typing in View 2 to affect View 1's code snippet. If we compare to selection, typing in View 2 does not affect the selection in View 1.

Is is possible to implement it at the view level instead of document level so that the views don't affect one another?

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

Hi Xinen,

We will add some code for the next maintenance release that checks to see if the editor's ActiveView is the one in which the code snippet template session is active, and only close when text changes occur outside of the template session in that case.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

ok sounds good. Will that be in 634?

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

Yes.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro

It seems like this has not been fixed - typing in View 2 will still affect View 1's code snippet.

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

Hello,

I just tested this and don't see any problems.  All the updates described above seem to be in place.  Please give specific detail on what you are seeing and we'll have a look.  Thanks!


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Hi Actipro,

Sorry I wasn't clear on what I was doing. When I said multiple views, I actually meant that I have multiple Syntax Editors, each showing a view of the same document. Not just different split views in one editor. So I have multiple windows, each with its own SyntaxEditor, but all sharing the same document.

Hence each of my editors will still think they are the "ActiveView". We need a way to ensure only the editor with keyboard focus will exit its code snippet session.

I've tried adding an extra check for 'this.View.HasFocus()' in addition to the 'ActiveView == this.View' check and it worked for me perfectly. Could you add that in please?

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

Hi Xinen,

Ok we will add that check too.


Actipro Software Support

Posted 3 years ago by Xinen Lee
Avatar

Thanks!

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.