Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Create from usage (and other options) not showing

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
MikMik Posted - Nov 16 2021 : 06:17:30 AM
Hi,
I'm trying to use "Create from usage" but the option does not show when I press SHIFT+ALT+Q (VA Refactor context menu) and it is greyed out in the refactoring menu.

We have quite a big solution, with probably all kinds of issues (files "too long", with mixed tabs and spaces, mixed line endings, Unicode characters...), so it is not easy to create a minimal example. In fact, with newly created files it usually works (though not always).

I don't know if it is related, but there are other options missing too, like "Move Selection to new file".

Is there anything I can check to know why it is failing to show those options (and fix it)?
Thanks!
10   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Nov 18 2021 : 07:39:45 AM
Very unexpected. It sounds like the same root problem is triggering both bugs. Hopefully our study of this in the other thread will get us somewhere quickly.
MikMik Posted - Nov 18 2021 : 03:24:59 AM
Yes, you are exactly right. It is not working even with the simple snippet you provided, no matter where I put it. But all the options you mention seem to be working...

However, after my finding in my other thread about Create File that in some projects it works, I've tried Create From Usage in differen projects too, and I get the same result: it works in exe projects, but not in dll projects. I think something in the configuration (some path or something) must be messing up with VA...
feline Posted - Nov 17 2021 : 12:11:34 PM
So create from usage is failing even with the very simple test function? I just want to make sure I understand correctly.

Does it still fail with this simple test function at the top of a cpp file?

I had guessed create from usage was failing since VA did not understand the type on the right hand sign of the =

but if even the very simple test case above is failing then this doesn't make much sense. If VA is this confused then you should be seeing problems with next and previous scope, VA Outline, Alt-M list, and just in general.
MikMik Posted - Nov 17 2021 : 07:49:02 AM
I had already rebuilt the database yesterday, but I've done it again. "Create from usage" has worked for a little while... I've pasted the snippet in a previous message in a few places, built the project... And suddenly it's stopped working...

Alt+Up and the navigation bar seem to be working just fine... The caret goes where it is supposed to, and the navigation bar updates with the correct context and definition for the symbols, as far as I can tell...
feline Posted - Nov 17 2021 : 07:30:05 AM
The fact that Create from Usage seems to stop working after a while suggests that something is confusing our parser.

Have you tried rebuilding VA's symbol database yet? This might help, or it might have no effect, but it should be a fairly fast test, unless you have a really massive solution. You can trigger this via:

VA Options -> Performance -> Rebuild symbol databases

and then restart the IDE.

Assuming this doesn't help, when Create from Usage stops working, can you please try using Alt+Up Arrow. This should take you to the top of the current scope. Does this take you to the correct location? If you use it again do you end up at the top of the current function, or somewhere else?

If you place the caret into known symbol names just before and above, and just after, where you are trying to use Create from Usage, what, if anything, is shown in VA's navigation bar? This is normally placed at the top of the editor window, and is where the Alt-M list appears from.

If Create from Usage isn't working then its likely that VA cannot work anything out. If that is happening then VA probably is having problems identifying symbols correctly. If we can prove this is happening it gives us something much more specific to study, and should help us to pin down what is going wrong and the limits of the problem. Hopefully this makes sense and you can see what I am thinking here.
MikMik Posted - Nov 17 2021 : 02:04:28 AM
I knew my steps to reproduce wouldn't be very helpful, because they don't seem to work in a toy example... But maybe they could point you in the right direction, or give you new ideas to try and test...
Anyway, I will keep trying it, and if I will report back if I find a reliable way to reproduce it. Create from usage" is, in my opinion, one of the top features of Visual Assist, and not being able to use it, is a bummer...
feline Posted - Nov 16 2021 : 11:57:54 AM
That is really unhelpful.

One surprise I ran into with the Create File bug thread is that white space, a single tab or space, is enough to stop the bug appearing! If you don't have:

IDE Edit menu -> Advanced -> View White Space

turned On then it will be very hard to notice this pattern. I don't know if that will help you or not though.
MikMik Posted - Nov 16 2021 : 11:32:37 AM
Here's a test I've done a few times and reproduces reliably in my setup:

Reopen Visual Studio so "Create From Usage" works.
Paste the snippet you passed me at the end of a file: create from usage shows
Move it around: it still shows

Build the project: the compilation fails, because I did not end up creating the variable, but Create from usage still shows

Delete the snippet

Build again

Paste the snippet again. Now create from usage doesn't appear
MikMik Posted - Nov 16 2021 : 11:19:31 AM
I'm getting mixed results here. I've been able to make "Create From Usage" work by closing Visual Studio and opening it again. Also, it seems to be working everywhere. It doesn't matter if the code is at the beginning, in the middle or at the end of the file... It even works inside the functions where it didn't before... However, it stops working at some point when I'm testing different positions in code, and I havent' been able to pinpoint when. It may be related to building the project/solution, or a matter of time (background parsing?)...
feline Posted - Nov 16 2021 : 08:57:25 AM
Files to long should not be a normal problem you encounter. My large test file, for stress testing VA with a big file, is 23,000 lines long. Hopefully you don't have to many files in this size range and bigger.

VA should generally handle both mixed line endings and Unicode characters. Odd bugs do turn up, so it is good to know to watch for this. Mixed spaces and tabs should not matter at all.

Move Selection to new file may be having problems due to your other thread about Create File not working. So lets try to get Create File worked out first.

For create from usage, can you add the following very simple test function to the top of a file where you see the problem:

static void simpleVACreateTestCase()
{
	long* pTestLongPtr;
	// you should be able to trigger create from usage on "newGlobalVar4"
	newGlobalVar4 = pTestLongPtr;
}

testing at the top of the file helps to eliminate any "cascade" errors because something further up the file, sometimes even a #include statement, is confusing our parser.

Does this test case work correctly for you, or do you get the problem here?

If it works correctly here, can you please try moving the function to below a function where you are seeing problems with Create from Usage. Again just trying to get a sense of where and why you are having problems, so we can pin down the triggers and try to fix this.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000