Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Snippets with dropdown

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
BoomRaccoon Posted - Feb 02 2023 : 02:22:31 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Feb 21 2023 : 1:55:44 PM
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
BoomRaccoon Posted - Feb 20 2023 : 6:01:47 PM
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.
feline Posted - Feb 02 2023 : 06:33:53 AM
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.

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