Posted 18 years ago by Russell Mason
Avatar
Hi

Will version 4 have the ability to create Smart Tags?

Thanks
Russell Mason

Comments (5)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We haven't to that yet (still trying to get over the hump on some language design changes) but it is something we want to look into. It would help if you could post any design ideas you have on it so we can include them in our TODO list. Things like how you want them to work, object model designs, scenarios you've seen in other apps that would be nice to emulate, etc...


Actipro Software Support

Posted 18 years ago by Russell Mason
Avatar
Hi

Not sure if this helps but here goes...

The application I'm thinking of is, not surprisingly, Visual Studio 2005. Mainly for use with re-factoring.

Here's an example:

SQL is sometimes a bit back-to-front, i.e. SELECT - what comes here in an InteiiSense list? You don't have a table etc. yet, and presenting all columns, for example, would be overkill and take a while to populate. You could do this - SELECT Orders.Id, Orders.Code FROM Orders o.
The IntelliSense list would provide tables by default, then when you type '.' you have enough information to just provide columns for that table. However Orders.Id is a bit unnatural for an SQL statement so when you type 'o' a SmartTag indicator comes up and the options include re-alias Orders to o, resulting in SELECT o.Id, o.Code FROM Orders o.

I would foresee the SmartTag being an extremely simple model (See suggested properties/methods/events below). This is how I see it working:
1) Respond to an event raised by SyntaxEditor etc. e.g. Typing or parsing
2) Determine the context of the token where the change was made
Nothing new yet - this could also be ignored and the following done based on some other logic
3) Call SmartTag.ShowIndicator with the offset of the token or wherever the appropriate context is. This would display the little yellow underline indicator.
4) When the user hovers the mouse over the indicator you raise the Popup event then show the SmartTag square (The yellow underline indicator is hidden)
5) When the user hovers the mouse over the SmartTag the tool tip is displayed and the drop down arrow added to the SmartTag. If the user moves the mouse away the drop down arrow is removed but the SmartTag remains for a few seconds then reverts to the yellow underline indicator
6) When the user clicks on the SmartTag you raise the Click event

That's it. It would then be up the developer to display the options list (this allows the developer to use their own menus - no offence but I use a different set of menu components and would like the options to be consistent with my application's style). The developer then just responds to the menus click event as they would any other menu and do whatever they want.

As far as I can tell from VS2005 there is only ever 1 SmartTag active at a time so it could be static as I've indicated. If you know differently then this would obviously need to be instance based and you may want to add a SmartTagCollection.

I hope this is simple yet does everything that is needed. While I'm sure you could improve upon this in future versions but when, how, and what, is up to you.

I've used the word 'Indicator' here, I'm not sure if there is an official term or you can think of something better.

Class: SmartTag

// Text displayed in tool tip when the mouse is hovered over the SmartTag
Propery: string ToolTipText

// Is the yellow underline being shown
Property: bool IndicatorVisible

// Is the SmartTag being shown - This allows for things like 'if (SmartTag.Visible) SmartTag.Clear();'
Property: bool Visible

// This would be the screen or client location where the SmartTag would be displayed
Property: Point Location

// Shows the yellow underline indicator at the specified offset (If the indicator is already showing elsewhere then it is hidden and shown at the new offset - that assumes there can only be one SmartTag active at a time)
Method: void ShowIndicator(int offset)

// Hides the currently dispalyed indicator (if not showing does nothing)
Method: void HideIndicator()

// Shows the SmartTag at the offset previously set with ShowIndicator (if the indicator is not visible then does nothing)
Method: void Show()

// Shows the SmartTag at the specified offset (hides the indicator) - This also allows for showing the SmartTag without ever having shown the indicator (If the SmartTag is already showing elsewhere then it is hidden and shown at the new offset - that assumes there can only be one SmartTag active at a time)
Method: void Show(int offset)

// Hides the currently displayed SmartTag (if not showing does nothing) and re-displays the yellow underline indicator at the offset specifies when Show was called
Method: void Hide()

// Hides the SmartTag if visible, hides the indicator if visible (if neither showing then does nothing)
Method: void Clear();

// Occurs when the user hovers the mouse over the yellow underline indicator and the SmartTag is displayed
Event: EventHandler Popup

// Occurs when the SmartTag is clicked - This allows the developer to show the options menu or take any other action
Event: EventArgs Click


Thanks
Russell Mason
Posted 18 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
Great suggestions Russell. This sounds like a clean design approach that would be similar to how other IntelliSense features currently work with SE. I agree that the SmartTag should not include a built-in menu system and should simply allow the developer to popup their own menu (even though I use UIStudio's excellent menu system, I'd like the flexibility). Emulating VS 2005 would be the ideal approach.
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Russell,

Excellint information. Couple questions... can you give me a couple steps to show the smart tags in VS? I know I've seen them before but for the life of me I can't get one to pop up now that I'm looking for it. :)

Also, do you thing we need to support a collection of them or is there only one available at any given time?


Actipro Software Support

Posted 18 years ago by Russell Mason
Avatar
Hi

As I said I can only see 1 Tag available at a time, i.e. when you make a change you get the tag option, if you make another change the tag moves and the previous change cannot be revisited. The only reason I mentioned a collection was in case I have missed something, but if its hard to find then there's no loss in not having it! I would be very happy, and in fact would prefer for the sake of simplicity, if this were static and the single SmartTag restriction was applied.

A couple of examples to get SmartTags to appear in VS2005:
Open a Windows Forms project

1) Goto the form's code and change the class name from Form1 to Form 2. Under the 2 a little yellow rectangle appears. Hover over it and the SmartTag appears. In this example you get the ability to rename 'Form1' to 'Form2' (and others)

2) In the Form1() constructor type Debug (C# case-sensitive). The SmartTag options now allow you to insert 'using System.Diagnostics' (and others)

Thanks
Russell Mason
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.