Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Occasional VA error when renaming

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
Uniwares Posted - Apr 21 2020 : 06:03:24 AM
Sometimes I get an error when I am renaming class fields using the VS Rename feature (default Ctr+R, Ctrl+R).
When I type fast and hit enter to rename, sometimes I get the VA error "Cant edit current document". I guess that VA detects that I am modifying a member and pops up the rename context menu, which of course gets executed on Enter.

When close the message box and hit enter again, VS executes the rename as expected.

Hard to repro consistently, just happens 1 out of 10 times or so.
13   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 01 2020 : 09:59:42 AM
Going back to your screen shot, the black event in the tooltip should be covered by:

case=141209

The comment formatting in the tooltip should be covered by:

case=142189
Uniwares Posted - Apr 24 2020 : 12:41:58 PM
Same file. When you change the last letter of SecondChanged and then change it back, you should get the very same list. (Yeah, i am doing lots of renaming as I go along with this project to get names right)
feline Posted - Apr 24 2020 : 12:38:28 PM
I am closing in on the odd colouring in the listbox tooltip. Given the C# code:

public class ClockTest
{
    public delegate void SecondChangeHandler(object clock, TimeInfoEventArgs timeInformation);

    /// <summary>
    /// using "event" keyword here means this can only be accessed by delegates
    /// </summary>
    public event SecondChangeHandler SecondChanged;

    private void testSuggestionListboxHere()
    {
        // typing here
    }
}

I can get a VA suggestion listbox that suggests "SecondChanged", and shows the XML comment in the tooltip. But the first line of the tooltip only shows:

SecondChangeHandler ClockTest.SecondChanged

no sign of the "public event" that you have in your tooltip. Are you getting this suggestion listbox and tooltip in the same class as defines the event? Or are you working in a different class? Reading up on delegate and event as I go, to figure out what is happening here.
Uniwares Posted - Apr 23 2020 : 10:42:13 AM
quote:
Originally posted by feline

Having a local variable with the same name in more than one function is relatively common, so the existing variable name might make sense as a suggestion.

Here we are at the class member level, so no duplicates. Also, the same name isnt used anywhere else.

quote:
Originally posted by feline

Agreed, the toolip is clearly coloured wrongly. Do you get the same colouring problem for anything else with this return type? I am wondering if this is related to the return type its self, or is somehow related to what this is that you are hovering over, to generate the tooltip.


The tooltip shown is the one that appears as hint for the currently selected menu item. And nowhere else I see this miscoloring like here.

quote:
Originally posted by feline

For the comment, remember VA has to work around the IDE, not always doing things in an "obvious and sensible" manor.


Maybe can get the description/comments from the IDE? Dont know. At this point its not really time sensitive. But would be really great to have. Also adds some sense of uniformity.
Uniwares Posted - Apr 23 2020 : 10:36:34 AM
quote:
Originally posted by feline

Can you check and see if you have set VA suggestion listboxes to always have focus? The setting is described here:

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



This entry doesnt even exist in my registry. But I have ListboxCompletionRequiresSelection= 0x00
Maybe this has an influence? Not that I've set it manually.
feline Posted - Apr 23 2020 : 10:16:31 AM
Also, your latest screen shot, no focus in the suggestion listbox, so when you are adding _ to the start of the variable names, I don't understand why the listbox should be appearing with keyboard focus, since it isn't doing so for me.
feline Posted - Apr 23 2020 : 10:15:40 AM
Cross posting. The last post was about renaming the variables by placing _ at the front.

Since this is a suggestion, VA is effectively guessing. Having a local variable with the same name in more than one function is relatively common, so the existing variable name might make sense as a suggestion. Not in this exact situation, but in general, it doesn't seem stupid.

Agreed, the toolip is clearly coloured wrongly. Do you get the same colouring problem for anything else with this return type? I am wondering if this is related to the return type its self, or is somehow related to what this is that you are hovering over, to generate the tooltip.

For the comment, remember VA has to work around the IDE, not always doing things in an "obvious and sensible" manor. With the comment clearly marked as a comment, we know that the text should be coloured as a comment, if you enable tooltip colouring. Without these comment markers at the start of the line we don't automatically know this is a comment, so you can end up with VA applying source code colouring to the comment description. Given "proper" context it is obvious this is a comment, but we don't always get to work with "proper" context.
feline Posted - Apr 23 2020 : 10:08:23 AM
I am seeing similar behaviour here, but for me, when the "_onevar" suggestion listbox appears, it does not have focus, which is what I would expect. This looks like, and is a variable declaration, on declaration lines, by default, suggestions should not have focus.

Can you check and see if you have set VA suggestion listboxes to always have focus? The setting is described here:

https://docs.wholetomato.com/default.asp?W350
Uniwares Posted - Apr 23 2020 : 07:46:08 AM
This is related:




A few things are wrong here:
1) why would VA suggest whats already there? (I have deleted the last letter, and reentered it again, then the menu popped up)
2) the tooltip is colored wrongly
3) the tooltip shows the raw comment, not the rendered comment
Uniwares Posted - Apr 23 2020 : 05:21:17 AM
I think I found a pattern here. And it seems to be caused by something else.
When I rename various fields in sequence like:

private int onevar;      // -> becomes _onevar
private int secondvar;   // -> becomes _secondvar;


So I position the care at the beginning of "onevar", type "_", wait a bit, the VA rename menu comes up, I select rename, hit Enter.
Cursor down to the beginning of "secondvar", type "_", and now VA pops up with a menu suggesting "onevar" which is selected already. Bang.

I guess that is what happens when using VS Rename (Ctrl+R, Ctrl+R) too. The first works fine, on the next ones VA probably pops this suggesting/completion menu up and this causes the error because VS is in the rename state.

feline Posted - Apr 21 2020 : 07:19:03 AM
It could be typing speed, or something else "minor" as well. Or I simply did not run enough tests, but given how often you are seeing this, I was hoping to see it at least once or twice per machine. Any clues would be most welcome, that is a rather unhelpful message box.
Uniwares Posted - Apr 21 2020 : 07:13:00 AM
No, just type the name and Enter, nothing else. Thinking about it I supposed it might have any relation with the project being under source control (check out on change, etc.) but then again, last time it happened it was in a new file that wasnt even checked in yet.
Guess I�ll have to watch out for this one.
feline Posted - Apr 21 2020 : 07:08:27 AM
I have been trying this here on two different machines, both using VS2019 and VA 2366.0. One is my standard settings, and one has your imported VA and IDE settings. I have run probably 40+ IDE renames on each machine, using random names to type quickly into the editor, for the rename, and so far no sign of this error message here.

Some of the time I am seeing a VA listbox appear when I am typing, but it is never getting focus unless I use the Up or Down arrow keys while typing.

Do you think you might be moving focus into the VA listbox before pressing Enter for the IDE rename, and this might be part of what is going on? Or it is possible I am doing this slightly differently to you.

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