Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 VA 2393: Snippets fail with new files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dmayola
Junior Member

Spain
10 Posts

Posted - Nov 30 2020 :  03:25:47 AM  Show Profile  Reply with Quote
Hi,

I have some snippets for setting up new files.

I normally add a source file and a header file (aka. .h and .cpp) from windows explorer. Then, I drag the header to the editor, I type my snippet and everything is fine. Next, I drag the source file and try to type the snippet, unfortunately, visual studio doesn't show me any hits (unless I close the header file, then it works after a couple of tries).

Thank you,
David

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Nov 30 2020 :  07:07:58 AM  Show Profile  Reply with Quote
Is VA showing its navigation bar at the top of the editor? This bar is where the Alt-M list appears.

If the bar is not showing then VA has not yet become active in the current file, and if VA is not active, then this would explain why the snippet is not working. But even if this is the case, it should not take this much fiddling before VA is active in the file.

Which IDE are you using? Is this a new problem in VA 2393, or have you seen this in previous builds as well?

zen is the art of being at one with the two'ness

Edited by - feline on Nov 30 2020 07:08:50 AM
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 01 2020 :  11:04:54 AM  Show Profile  Reply with Quote
Yes, the navigation bar appears at the top (it doesn't show anything because the file in almost blank)

It is not a recent bug I've seen it a long time now.

I am using Visual Studio Professional 2019, 16.8.2
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 02 2020 :  04:41:18 AM  Show Profile  Reply with Quote
So much for that theory. Do any snippets appear in listboxes when you are having this problem?

When you are having this problem, what happens if you press the VA Toolbar button "Insert VA Snippet"? You should get a menu appear, at the keyboard caret, and you can access all of your snippets from this menu.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 03 2020 :  07:13:52 AM  Show Profile  Reply with Quote
From VA Toolbar button it works.

When I type my snippet precisely it doesn't show anything. In that case, I am typing "class2" which is the snippet shortcut I am using, but, when I type only "class" I see some suggestions coming from defines in the game, but "class2" doesn't appear, actually, I have several "class{}" shortcuts, and none appear.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 03 2020 :  09:40:50 AM  Show Profile  Reply with Quote
Are you adding these files to your solution in Visual Studio? Or are you just editing the files without first adding them to the solution?

What happens if you type #in, which should trigger the VA Snippets for

#include <>
#include ""

does this snippet work correctly for you?

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 04 2020 :  03:38:06 AM  Show Profile  Reply with Quote
I am creating these files in the window's explorer and just dragging them in the editor; without adding them to the solution.

#in works fine in my case
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 04 2020 :  10:42:38 AM  Show Profile  Reply with Quote
Do you have a solution open in the IDE when this happens? Or do you have the IDE set to just open a collection of files from a directory?

I was able to reproduce this once, which is how I found that, for me, the "#in" shortcut worked, but the class shortcut did not work. But I cannot reproduce it again, so there seems to be some factor required for this to happen, but I am not sure what it is.

Once a snippet listbox has been triggered by "#in", even if you cancel the listbox and delete the shortcut, what happens if you now try the "class" shortcut? I am wondering if getting a snippet listbox to appear "fixes" the problem.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 05 2020 :  04:22:50 AM  Show Profile  Reply with Quote
I do it while I have my solution opened. Typing "#in" before doesn't seem to fix anything.

I have tried to isolate the problem to a new, almost empty, project. Hope that the following Gif helps out :)

https://we.tl/t-8OwjE9m0nQ

Edited by - dmayola on Dec 05 2020 04:37:31 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 07 2020 :  2:45:37 PM  Show Profile  Reply with Quote
Thank you for the recording. It looks like you jumped into the second, new file via Alt-O, since I didn't see you drag it across. Is that right?

Sadly, even trying this, I still cannot reproduce this on demand, which is frustrating, since it did happen, exactly once, for me.

Can you please export your VA and IDE settings and send them to me:

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

I can then import them here and see if I can reproduce the problem. Please send me the files via email:

support@wholetomato.com

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 08 2020 :  04:33:40 AM  Show Profile  Reply with Quote
Sent.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 08 2020 :  11:06:43 AM  Show Profile  Reply with Quote
I have the settings, thank you for these:

case=144181

Unfortunately I still cannot reproduce the problem here. How easily can you reproduce this problem, does it happen every time, or just some of the time?

If this always happens, can you please try disabling any other extensions you have installed? When importing your IDE settings I got 7 warnings about keyboard commands that don't exist. Some are for TSVN, and some are for "SelectNextOccurrence". I assume both sets come from other extensions, so it is possible they are somehow a factor.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 09 2020 :  04:10:58 AM  Show Profile  Reply with Quote
I can reproduce it almost 100%, I tried disabling all my extensions and the behaviour looks the same.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 09 2020 :  07:41:42 AM  Show Profile  Reply with Quote
Do snippets always fail in the same file extension?

This seems so simple to reproduce, but so far I have only done so once, and cannot reproduce it, even though I seem to be doing the same things.

Can you please close all instances of the IDE and then run the command:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe" /RootSuffix VATest

this will create and load a new, default profile for Visual Studio, so you will be asked which basic settings you want to use, and you should only have the standard, default IDE extensions installed. Visual Assist will not be installed into this profile, so you will need to go into the dialog:

IDE Extensions menu -> Manage Extensions

and install Visual Assist from the online extension store, to install VA for this test profile.

To load your normal, default profile just load the IDE normally. To return to this test profile again, pass the /RootSuffix command line switch when loading the IDE. You can run both profiles at the same time, next to each other. In VS2019 the profile name will be shown just under the close button, in the top right hand corner of the main IDE window. If you export your IDE settings from your main profile you can them import them into the test profile.

Can you see if you see the same problem in this test profile with it's default settings?

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 10 2020 :  12:19:42 PM  Show Profile  Reply with Quote
It looks like it doesn't depend on the extension. I could reproduce it in a .h and a .cpp.
I've followed your steps and could reproduce it with the default profile, without any more extensions, only visual assist and the repo-steps are the same.
Also, I've tried with different file names, but the same issue occurs.

Another test I've performed is to add several new files. The first works and following additions (just dragging, not include through visual studio) fail. However, one thing interesting is that closing the tab's file which was already include in the project didn't fix the snippet issue, but removing one of the dragged files, made the snippets to work again.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 14 2020 :  12:29:39 PM  Show Profile  Reply with Quote
I have tried with a few more files, and still cannot reproduce the problem here.

Does the location of the files that you are dragging into the IDE make any difference? Are they being dragged from a network drive, external storage, or any form of "different" location?

Let's try VA logs, maybe they will offer some insight into this odd problem.

With just your default solution open, can you please enable VA logging, via:

VA Options -> Performance -> Enable logging

now drag in some files and reproduce this problem, then close VA, to keep the log files from getting larger. This page explains what log files are created, and where to look for them:

https://support.wholetomato.com/default.asp?W305

Please send me the files via email:

support@wholetomato.com

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Dec 22 2020 :  09:33:15 AM  Show Profile  Reply with Quote
Hi,
Sorry for the late response

I have sent you an e-mail with the required log.

These files are dragged from regular places, nor network driver nor external storage. My use-case is simply inside the visual studio folder. However, I have tried from different locations just to see if we see some kind of pattern, but it looks like is not related to the location of the file.

Interestingly, I've just found out an important detail, this issue only happens when using variables. Note that an enter doesn't trigger the issue, you have to modify the variables.

Check my snippets ($first$ and $second$)


First snippet:

#pragma once

namespace $first$
{
namespace $second$
{

class $FILE_BASE$
{
public:
	virtual ~$FILE_BASE$() = default;
	
};

} // namespace $second$
} // namespace $first$



Second snippet:

#include "StdAfx.h"
#include "$FILE_BASE$.h"

namespace $first$
{
namespace $second$
{

} // namespace $second$
} // namespace $first$

Edited by - dmayola on Dec 22 2020 09:34:53 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Dec 23 2020 :  09:41:26 AM  Show Profile  Reply with Quote
That was it, I am now able to reproduce this on demand:

case=144243

I did wonder about asking for your snippets, but it didn't seem to matter. It turns out the specific snippet really does matter, thank you for discovering this.

In the new file, while typing the shortcut does not work, if you use the VA toolbar button "Insert VA Snippet" or map a keyboard shortcut to the command "VAssistX.VaSnippetInsert" then you access the list of snippets, and for me, this class2 snippet is in the list, and can be inserted from there, even when it is not showing up in the editor with a listbox suggestion.

Just don't be surprised if you get a dialog prompting you for the two namespace names, since VA is having a bit of a problem here, but the snippet is being entered correctly for me here, doing this.

zen is the art of being at one with the two'ness
Go to Top of Page

dmayola
Junior Member

Spain
10 Posts

Posted - Jan 12 2021 :  06:01:05 AM  Show Profile  Reply with Quote
I'm glad that we could figure out a way to reproduce it.

I've tried to assign a shortcut to "VAssistX.VaSnippetInsert" and that works just fine; unfortunately, it's not really usable because I have too many snippets and they are not filtered as I type.

Could you check why typing the shortcut in such a way doesn't work?

Thank you in advance.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17095 Posts

Posted - Jan 12 2021 :  07:51:45 AM  Show Profile  Reply with Quote
I have put in a bug report for these snippets not working, but unfortunately I don't yet have an estimate for when this will be fixed.

When you open the VA Snippet Insert menu, what is the top item? Is it "VA Snippets with $selected$" or do you have one or more snippets listed first, above this entry?

How many snippets do you want to have easy access to for setting up a new file?

Inside the VA Snippet editor, on the right hand side at the top, there is the pull down list filter "Type". If you select the filter type "With Title Only" you will see all the snippets for your current language that only have a title, so no shortcut and no surround with.

These snippets are listed, in alphabetical order, at the top of the insert snippet menu when you select it.

So if you only have a small number of snippets that you want to use to start setting up new files, like your first and second snippets above, if you copy and paste them inside the Snippet Editor dialog, thus duplicating them, you can set the title, and remove the shortcut from the duplicate, so these snippets will appear at the top of the menu, making them easy to select and enter into your files.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000