Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 C# end-of-line comments in intellisense tooltips

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
Gaddy Posted - Jun 24 2019 : 06:51:08 AM
Would it be possible for Visual Assist, in C#, to take into account the end-of-line classic "//" comments, so they appear in the "intellisense" tooltips ?

That way such comments woudl appear in the tooltips:
public int a; // This is A
public int b; // This is B


Or those ones, using a xml tag if necessary (a new tag maybe?)
public int a; /// <summary>This is A</summary>
public int b; /// <summary>This is B</summary>



When there are several variables, such end-of-line comments would be so much easier to read than the xml comments in the line above. Those are all mixed up, very confusing and very hard to read ; but are the only solution for now to get the comments taken into account by intellisence

/// <summary>This is A</summary>
public int a;
/// <summary>This is B</summary>
public int b;


Visual studio does it perfectly well for c++ comments, so maybe Visual Assist could have an option to use the C++ intellisense documentation instead of the C# xml one?
27   L A T E S T    R E P L I E S    (Newest First)
foxmuldr Posted - May 28 2020 : 10:30:35 AM
quote:
Originally posted by Gaddy

If this has been a request of you for a few years, already answered negatively... whatever you agree or not with the explanation, maybe it's time to give up?
And either write it yourself (you seem to know your stuff!) or find another Visual Studio extension that could include it?
And so keeping this post about its original subject :-)



I had mentioned in another thread writing Code Helper which would be an open-source version of VAX. My goal is to not write that entire thing, but to augment VAX so I don't have to write it. I may have no choice though.

It's not so hard to do as people think. They just need some encouragement and movement in helping methinks.

Also, this post is about your original subject. You're looking for a way to remove the extra spaces in the tooltip. This solution would address your needs, and scores of others.
Gaddy Posted - May 28 2020 : 10:25:03 AM
If this has been a request of you for a few years, already answered negatively... whatever you agree or not with the explanation, maybe it's time to give up?
And either write it yourself (you seem to know your stuff!) or find another Visual Studio extension that could include it?
And so keeping this post about its original subject :-)
foxmuldr Posted - May 28 2020 : 10:19:19 AM
quote:
Originally posted by Gaddy

@foxmuldr : I think you should accept the answer ? It's their software, they know how it works and the difficulty of the task.
It's fine to request some feature but let's just stop there.

Myself i made a video game and I had plenty of players asking me to add modding support (which is not that different from what you suggest). Very difficult to explain that no, it's very complicated!

Anyway, maybe we could stick to the original request, about a small fix in the way of showing end-of-lines C# comments in intellisense tooltip :-)



This has been of a request of mine for a few years.

And it's not hard. It's 50 lines of code to get it setup, to connect to the DLL and load in anything that's enabled in the add-in. And then it's additional processing so that before you call renderTooltip(text); you instead call renderTooltip(fixup_tooltips(text)); and write a fixup_tooltips() function that sees if any add-in DLLs are loaded, and iterates through them one-by-one receiving the new string.

It's quite easy actually to add in those kinds of fixups.

Off the top of my head, untested:
struct SAddinFuncs
{
    HMODULE hmod;

    // Supported functions
    bool (*fixup_tooltip)(String* input, String** output);
    // Other functions go here
};

SAddinFuncs* load_third_party_addin(char* pathname)
{
    HMODULE hmod = LoadLibrary(pathname);
    if (!hmod)
        return NULL;

    SAddinFuncs* addin = new SAddinFuncs;
    addin->hmod = hmod;
    addin->fixup_tooltip = GetProcAddress(hmod, "fixup_toolip");
    // Repeat for other functions
    return addin;
}


And you'd have to add that SAddinFuncs* that's returned to some array or linked list or whatever. From there, you iterate:

String* fixup_tooltips(String* input)
{
    String* output;

    for (int lnI = 0; lnI < addins.size(); ++lnI)
    {
        SAddinFuncs* addin = addins.get(lnI);
        if (addin->fixup_tooltip)
        {
            ouptut = NULL;
            if (addin->fixup_tooltip(input, &output) && output)
            {
                delete input;
                input = output;
            }
        }
    }

    // Return the updated string
    return input;
}


Something like that fleshed out and debugged would do it.
Gaddy Posted - May 28 2020 : 09:44:23 AM
@foxmuldr : I think you should accept the answer ? It's their software, they know how it works and the difficulty of the task.
It's fine to request some feature but let's just stop there.

Myself i made a video game and I had plenty of players asking me to add modding support (which is not that different from what you suggest). Very difficult to explain that no, it's very complicated!

Anyway, maybe we could stick to the original request, about a small fix in the way of showing end-of-lines C# comments in intellisense tooltip :-)
foxmuldr Posted - May 28 2020 : 09:36:15 AM
quote:
Originally posted by feline

You are asking for a LOT of work here, in terms of making VA extendable, and maintaining this extendability. This is hardly an efficient (good) solution to this particular problem.

There are already existing open bug reports for duplicate tooltip problems, where both VA and the IDE each end up showing their own tooltips. Then you have to consider that different IDE's and languages work differently.




If you want some help, there are likely those of us who will assist you with existing bugs under NDA so we could add some of the features we want as well. I would be willing to add in the extension aspect. I doubt it's as much work as you think. I am willing to code up a prototype and demonstrate. LoadLibrary() and GetProcAddress() make it easy to add-in plugins to your own VA extension.
feline Posted - May 28 2020 : 09:03:00 AM
You are asking for a LOT of work here, in terms of making VA extendable, and maintaining this extendability. This is hardly an efficient (good) solution to this particular problem.

There are already existing open bug reports for duplicate tooltip problems, where both VA and the IDE each end up showing their own tooltips. Then you have to consider that different IDE's and languages work differently.
foxmuldr Posted - May 28 2020 : 07:57:12 AM
quote:
Originally posted by feline

You are assuming we have full control over what the IDE is doing. You are also assuming we have "full" information. We are extending and working around the IDE, which complicates matters.



Do you render your text into an HWND with DrawText() or some equivalent? Are you intercepting the HWND Visual Studio pops up, pointing WndProc() to your own handler, resizing it, issuing InvalidateRect() so you can re-paint it with your own text?

It's just one example of how we could add to your product.

You seem reticent to even consider allowing fixup_popup() and other such DLL functions we could create and use to extend VA. Is there someone else there I could talk to? :-)

--
Rick C. Hodgin
feline Posted - May 28 2020 : 05:31:42 AM
You are assuming we have full control over what the IDE is doing. You are also assuming we have "full" information. We are extending and working around the IDE, which complicates matters.
foxmuldr Posted - May 27 2020 : 3:01:00 PM
quote:
Originally posted by feline

Unfortunately no. The double space is due to the fact that we are extending an existing tooltip, not generating the tooltip from first principles.



I presume you have some text you are using to physically render?

"Example tooltip line up top\n"
"\n"
"\n"
"Example that's too far down\n"


You're rendering it with DrawText() or some custom equivalent that uses DrawText() with DT_CALCRECT to determine syntax highlighting and placement? I do this in my own editor's syntax highlighting algorithm.

Before you render or parse for syntax highlighting, send the string VA has generated to the add-in DLL, and retrieve back the updated string. Then syntax highlight and render the updated one.
feline Posted - May 27 2020 : 12:08:06 PM
Unfortunately no. The double space is due to the fact that we are extending an existing tooltip, not generating the tooltip from first principles.
foxmuldr Posted - May 27 2020 : 09:25:24 AM
quote:
Originally posted by feline
In this specific situation, if I understand correctly, the user would need to write their own parser, to locate the comments after the functions, and then use this parser inside an extension for VA, to add the comments after the functions to the VA tooltips...


In this specific example, VA would send the text it's about to render into the tooltip to the fixup_tooltip() function, which would simply remove double-spaces, thereby addressing the developer's desire to not see double-spaces without VA having to write any code changes to fix this specific issue.

The whole goal is to have VA doing what it's already doing, and then passing what you've already done to external code for last minute fixups or tweaks to provide whatever we're in search of.

The developer could also write features to add whatever they want to tooltips popped up by VA. Or to trim it down. It would be a useful extension.
Gaddy Posted - May 27 2020 : 09:19:59 AM
Thank you for the explanations!
feline Posted - May 27 2020 : 09:15:33 AM
The blank lines are happening when VA is adding an additional comment to the tooltip. This is still a known, minor, bug. Unfortunately no estimate yet for when we will be able to do something about this.

Our bug tracker isn't open to customers, but you can always ask either here or via email for an update on any particular bug, and we also post details of what has been fixed in each new version here:

You can download older builds of VA from this page:

https://support.wholetomato.com/default.asp?W404
Gaddy Posted - May 27 2020 : 08:31:42 AM
quote:
Originally posted by feline

We don't have any say over how the IDE picks up comments in C#. We do try to help, but sometimes all I can do is offer a work around for a particular situation, not an instant fix.


Hello! Do this reply relates to my request (about removing empty lines in the VA "show additional comments") ? With @foxmuldr huge suggestion I'm a bit lost...
Also, you talked about a case 142189 - is there a way to follow this case, or to get some automatic email when updated/resolved?
feline Posted - May 27 2020 : 08:25:21 AM
There is nothing stopping you writing your own extension to add features to the IDE. If you simply want a notification tooltip to appear on schedule, this should be easy to implement. Adding this all the way through VA, safely, is a significant task.

In this specific situation, if I understand correctly, the user would need to write their own parser, to locate the comments after the functions, and then use this parser inside an extension for VA, to add the comments after the functions to the VA tooltips... I suspect if they really wanted to do this, writing a parser to just move the comments to a position the IDE and VA expect would be quicker, easier and more reliable. You might even get semi-reasonable results with a carefully designed regular expression search and replace.

But here, as I understand it, the user want's VA to support their existing formatting automatically, without any work on their part. Since this is a formatting style that the IDE does not support, I asked if there is a particular reason for this, to help justify the work required.
foxmuldr Posted - May 26 2020 : 1:24:40 PM
quote:
Originally posted by feline

We don't have any say over how the IDE picks up comments in C#. We do try to help, but sometimes all I can do is offer a work around for a particular situation, not an instant fix.



This is one of those cases where we could augment what VA does.

You could pass the string you're getting ready to render to a fixup() algorithm to alter it, and return back the altered version. You could then display that one.

We could look at the thing being passed in and determine if it needs to be fixed up, and if so, then do so and pass back a new string.

struct SDllCallbacks
{
    HMODULE     dll;

    // Callback methods defined in the DLL
    bool    (*fixup_tooltip)(CString* input, CString** output);
};


Add code to call LoadLibrary() on the add-on DLL list you have saved in your VAssistX Options screen somewhere. Use GetProcAddress() for every function that you've exposed, the "fixup_tooltip()" function in this case. If they exist, then set it, and in your code iterate through every loaded add-on DLL and call any non-NULL addresses with the input string and a pointer to a newly allocated output string if it was altered. The add-on DLL returns true if it was fixed up and a new string was cretaed, false if not.

You could add dozens of things like that and we could add value to your product by being able to fixup and alter things you're already doing on-the-fly so you don't have to. We could even have it check our calendar on a tooltip and popup the message, "Hey, that online meeting starts in 5 minutes!!" in addition to the normal tooltip text.

The goal is to empower developers. We know our specific needs better than you do. You have limited resources, so expose some of these abilities and let us do the heavy lifting specific to us where it's required.

It's kind of like how skins worked on WinAmp back in the day. The base functionality of WinAmp existed (that's like VA). But we could skin it however we wanted (that's like our add-on DLLs which alter some things). You could also pass in your own callback structure filled with functions we can call into VA's code base so we could have it do things you are willing to expose.

-----
I'm willing to write a fully functional example of this code tonight if you have any interest in considering it.
feline Posted - May 26 2020 : 09:49:02 AM
We don't have any say over how the IDE picks up comments in C#. We do try to help, but sometimes all I can do is offer a work around for a particular situation, not an instant fix.
feline Posted - Apr 29 2020 : 05:39:15 AM
I just wanted to double check that. Removing the extra lines is covered by case=142189, but I am not sure when we will have a go at this.
Gaddy Posted - Apr 28 2020 : 09:40:27 AM
Thank you for the color advice, but I had no problem with that, it was all fine.
Comments are picked correctly by VA, no issue there.

I just wished for the blank lines to be removed, currently the tooltip box is very large because of it, it's not very handy (cf. my screenshots above)
feline Posted - Apr 28 2020 : 09:35:05 AM
The formatting is different, but VA does know which part of the tooltip text is the comment, so is able to apply syntax colouring to the comment, assuming you have turned On

VA Options -> Coloring and Attributes -> Apply coloring to -> Tooltips

Are you having issues with comments not being picked up correctly, or is VA picking them up correctly for you?
Gaddy Posted - Apr 28 2020 : 09:32:18 AM
Thank you for the feature request.

No, I prefer not to have to use XML tags in comments at all. I suggested it in my original post as a plan B, if it was not possible to manage simple // comments (I didn't know VAssist was already able to do it).
My only real need is to get nice intellisense comments tooltips for end of line comments.
feline Posted - Apr 28 2020 : 09:22:50 AM
I have put in a feature request to get the formatting of the IDE and VA comments to match in the tooltips:

case=142189

As for the XML comments after the variable, do you have a lot of code that does this? VA already handles standard // and /* */ comments after a variable, so I am wondering why you want to put XML comments here since the IDE does not seem to support or handle them?
Gaddy Posted - Apr 28 2020 : 03:57:46 AM
Hello
It's still exactly the same (end-of-lines comments are showed but with 2 empty lines (and the "//")) with the last version of Visual Assist & Visual Studio Community 2019.

As it's actually the one single feature I use from Visual Assist, I was wondering if you planned to improve this formatting someday?
Gaddy Posted - Jul 02 2019 : 2:50:09 PM
Thank you for the explanation.
Maybe for a future version, a check could be added to remove any empty line at the beginning of a tooltip message ?
feline Posted - Jun 26 2019 : 08:39:42 AM
Thank you for the update, I am glad this is working now

Sometimes we are modifying the tooltip that the IDE its self generates, other times we are generating our own tooltip in place of the IDE's tooltip, so there can be some minor differences in formatting, especially since different versions of the IDE format things slightly differently.
Gaddy Posted - Jun 25 2019 : 10:33:23 AM
It works, it's amazing!! I'll buy a license, impossible to live without it now


If I may, why is there an empty line in the tooltip (contrary to the default one as in the 2nd picture) ?

(Visual Studio Community 2017 15.9.13 and Visual Assist trial 10.9.2333.0 )






feline Posted - Jun 24 2019 : 2:53:38 PM
Can you please try turning On both VA options:

VA Options -> Display -> Show Quick Info tooltips for more symbols
Show additional comments when available

if this doesn't help, which IDE and version of VA are you using?

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