Suggestion: Dynamic Quick Texts / Snippets
It would be nice to augment Smart Bar's functionality with a user-defined selection of quick texts / snippets accessible from a dropdown or menu from a Smart Bar, such that they will be automatically inserted at the cursor position in a document. First few items may also be assigned a keyboard shortcut for even faster access.
In principle they would function similar to regular snippets, but will be dynamic. A few examples:
- Current DateTime in a user-specified format
- GUID
- Random number within a certain range
- Current file / folder / project name
For my specific case, I often find the need to know when a particular comment was written. Sure there is version control, but it is time consuming to use for such a small purpose, not to mention the fact that different comments may have been written at different times, but are all saved under a single version control check point. So, ability to quickly with just a predefined key combination to insert a current date would have helped a lot.
I have thought of that before.
The problem of implementing with SmartBar is that it usually appears after something is selected, which is not so easy for ordinary users to discover. For instance, if you type "guid" in your code, select it, you will see a new button within the SmartBar, which will replace the typed "guid" with a newly generated GUID. If you select a GUID (32 characters), and that magic button will also appear in SmartBar, which allows you replace current GUID with a new one.
Maybe we can augment the "intellisense" list. So when you type "guid" in the code editor and it can be expanded to a random GUID, and "today" expanded to the current date.
If you think that is better, I will see whether it is possible to implement that.
Yes, I actually think your idea is better! Smart Bar was just something I thought of would be easier to implement since it is already there, but of course ideally this feature would work best if it will require as little input from the user as possible. Perhaps event automatic replacing of "today" as you type it or some similar mechanic. But intellisense if it can be hacked that way is a great option and would open the door to more "dynamic snippets" like these!
The situation gets more complicated than I initially expected.
The traditional APIs for intellisense completion (ICompletionSourceProvider and ICompletionSource) are being abandoned in modern version of VS. Instead, async APIs like IAsyncCompletionSource and IAsyncCompletionSourceProvider are introduced, overriding the traditional ones.
The IAsyncCompletionSource has different method definitions in VS 2017 and later versions, which means that Codist can no longer support the old VS 2017 (I sometimes still use it) as well as the newer ones with a single extension release.
Oh, I see. Too bad multi-targeting is not possible for VS, as otherwise you could have used newer APIs for this feature, while simply not making it visible to the users of older VS.
It's possible to then use Smart Bar for this then after all?
Though on a more general note, the question is how much the requirement to support older VS versions for all features precludes taking advantage of newer APIs in later VS versions, so that extension can continue to improve and move forward?
Oh, I see. Too bad multi-targeting is not possible for VS, as otherwise you could have used newer APIs for this feature, while simply not making it visible to the users of older VS.
It's possible to then use Smart Bar for this then after all?
Though on a more general note, the question is how much the requirement to support older VS versions for all features precludes taking advantage of newer APIs in later VS versions, so that extension can continue to improve and move forward?
I still use VS 2017 for quick testing algorithm or code snippets. Therefore, I'd like to support it still.
I will try to find workarounds.