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
 Support for "User variables" in snippets?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kenny
Junior Member

19 Posts

Posted - Oct 16 2019 :  8:42:58 PM  Show Profile  Reply with Quote
Currently, there are a few "Reserved strings" provided to be used in a snippet, and that's great!
But, what if I wanted to repeatedly use some kind of string that appear across multiple snippets, AND, I frequently needed to change that said string on a daily basis?

I suggest VA add this new feature: allow users to add custom "user variables/macros" that can be referenced in a snippet, and provide a new UI (like a dialog that can be opened up via menu/hotkey) to add/delete/edit these variable entries (each entry includes a name and a value, names would be referenced in the snippets prefixed/enclosed with special symbol such as @).

Also, it would be great if we can also use "Reserved strings" inside those user variables.


Thanks.

Edited by - kenny on Oct 16 2019 8:45:56 PM

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Oct 18 2019 :  10:34:07 AM  Show Profile  Reply with Quote
Are you aware that you can use Windows Environment Variables inside VA Snippets? The environment variable is expanded to its current setting when you trigger the snippet:

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

This isn't quite the same as you are asking for, but it should have the same basic effect, since once the environment variable is set, it will be used by VA automatically. It just moves the management of these strings into windows environment strings.

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

kenny
Junior Member

19 Posts

Posted - Nov 13 2019 :  10:19:51 PM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Are you aware that you can use Windows Environment Variables inside VA Snippets?


I am aware of that, but changes made to environment variables won't be applied to VS instance when it is still running.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Nov 14 2019 :  10:34:36 AM  Show Profile  Reply with Quote
How many snippets are you using this changable block of text in? 2? 20? 200? I am trying to get a sensible sense of the scale of what you are doing and after here.

You mentioned changing these once a day, I take it that the changes are not on a "helpful" schedule, in the sense that you can restart the IDE in sync with when these changes need to be made?

Do you need to make these changes across several different machines, or just on one machine?

If you only need to modify a small number of snippets, and swap them between pre-defined strings, then you can delete the existing, now out of date, snippet from the snippet editor, and simply copy / paste in the new version of the snippet. If you copy a snippet the entire snippet, as an XML block, is copied to the Windows clipboard, so you can store out the snippets you want to swap between as these XML pieces, ready to copy back into the snippet editor on command.

But this will only work well for small numbers of snippets and changes.

Alternatively snippets are stored in a text file. If the file is modified outside of the IDE then VA detects this and re-reads the file, picking up the changes. So you could modify the snippets file directly, so long as your changable strings follow a well defined pattern in the file.

For example, you have a snippet that inserts the code:

// reserved string with default value = $CHANGABLE=fred was here$
// and again it is $CHANGABLE$


searching the snippet file for the $CHANGABLE=...$ block and changing all such blocks should be fairly simple and reliable, and this has the advantage of being something you can do with the current version of VA.

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

kenny
Junior Member

19 Posts

Posted - Nov 20 2019 :  12:52:17 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

How many snippets are you using this changable block of text in? 2? 20? 200?


Well, 3, not many. However...

quote:
You mentioned changing these once a day...

There are multiple different strings that I have to change, at least once per day, sometimes more.

quote:

Do you need to make these changes across several different machines, or just on one machine?


Just one machine.

quote:

If you only need to modify a small number of snippets, and swap them between pre-defined strings, then you can delete the existing, now out of date, snippet from the snippet editor, and simply copy / paste in the new version of the snippet.

This seems laborious.

quote:

So you could modify the snippets file directly

This is not really practical because apparently next time I change the snippets I'll have to find for different strings, and I need to find not just one string.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Nov 20 2019 :  08:35:52 AM  Show Profile  Reply with Quote
We are considering allowing VA Snippets to pick up and insert IDE variables, which would be easier to set and change without restarting the IDE than Windows environment variables:

case=76217

Since you are only looking at 3 snippets, and you only need to set the string's you are using once per snippet, at their first use, having these strings set via a different method isn't going to save you a massive amount of time here.

Are you aware that the latest versions of Windows 10 have a built in clipboard history feature? Available via Windows Key + V, which will help you with copy / pasting the strings between the different snippets fairly easily?

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