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
 Feature Requests
 Snippets with dropdown
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BoomRaccoon
New Member

7 Posts

Posted - Feb 02 2023 :  02:22:31 AM  Show Profile  Reply with Quote
Not sure if you guys use VSCode from time to time but they have so features that I love.

One of those is the ability to create snippets with drop-down-selection. A lot of functions take in an enum and it would be great to be able to select the enum instead of typing it.



Some bugs/annoying stuff I encountered:

-the suggestions for snippets don't show up for partial matches even after enabling the registry key
so a snippet that has "command" as a shortcut won't show up for "comm"

-(UE related) not sure why but when I type "AddDynamic(" it will automplete to "__Internal_AddDynamic()". Not sure if I missed a setting somewhere but in the Settings->Enhanced Listboxes->"Commit Selection with:" -> "Additional Characters" is turned off

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Feb 02 2023 :  06:33:53 AM  Show Profile  Reply with Quote
Have you tried turning On:

VA Options -> Suggestions -> Include Smart Suggestions

which are explained here?

https://docs.wholetomato.com/default.asp?W172

One of the things these are designed to do is to produce a listbox showing the members of an enum, when an enum is expected. Which sounds like it is what you are looking for.

For partial matches for snippets, do you have more than one snippet that could be triggered with "comm"? The documentation explains having several snippets with a shared prefix, it looks like the behaviour is expecting this to be the situation with your snippets. Otherwise if you just type "c" then you are going to see the "command" snippet suggested, which isn't as useful.

For "AddDynamic", is "AddDynamic" actually in the listbox you are seeing? I assume it isn't, from what you have described. If you are seeing a full listbox, as opposed to a suggestion listbox, then the setting:

IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Member List Commit Characters

also comes into play.

When I try this myself, I am getting a listbox with the single item "AddDynamic", so I am not seeing the same thing you are.

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

BoomRaccoon
New Member

7 Posts

Posted - Feb 20 2023 :  6:01:47 PM  Show Profile  Reply with Quote
I have that setting enabled but 'Include bits of code from surrounding lines' & 'Show only suggestions in complete lists' disabled.

So the listbox will work for any functions that are defined and indexed but it does not work for macros that's why it would be handy to have to option to specify custom suggestions

For example: I will get a suggestion for the macro 'DECLARE_LOG_CATEGORY_EXTERN(CategoryName, LogLevel, DefaultVerbosityLevel)' but the suggestions for the second argument won't give me the available options
So I made a snippet for it which looks like this

DECLARE_LOG_CATEGORY_EXTERN($logCategory$, $verbosity=LogLevel$, All);
$end$

In VSCode I would specify my own suggestions with something like '${2|Log,Warning,Error|}' which would let me select from those or type something else. It's also handy if you type the same thing for some arguments.

'AddDynamic' is not showing but '__Internal_AddDynamic' & '__Internal_AddUniqueDynamic' is showing even though I have the ' VA Options -> Suggestions -> Include Smart Suggestions' checked and have 'IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Disable Intellisense = True' so the Intellisense options are greyed out and shouldn't influence it.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Feb 21 2023 :  1:55:44 PM  Show Profile  Reply with Quote
Thank you for explaining. The problem with calling a macro is that since it is a macro, and not a function call, we don't have type information for the parameters, so VA's smart suggestions won't know what items to list.

As an immediate, if slightly messy work around, you could have the VA snippet insert either:

Log|Warning|Error

or

LogWarningError

for the second parameter defaults value. If you go for the second version you can use VA's Smart Select feature, with the settings:

VA Options -> Smart Select -> Changes in case delimit current word = ON
VA Options -> Smart Select -> Underscores delimit current word = ON

to easy select just the parts you want to delete. Expanding Smart Select for just a small selection is mapped to Shift+Alt+] by default. I find this remarkably useful for selecting parts of a symbol name when underscore or changes of case mark the parts.

I am tempted to suggest calling a function instead of the macro, so that you can simply use VA's built in smart suggestion feature:

https://docs.wholetomato.com/default.asp?W172

but I doubt that is really a great solution. I can see how this would be rather helpful whenever you are working quite a lot with macros, so I have put in a feature request for this to see what out developers make of it:

case=149194

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:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000