Author |
Topic |
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Aug 23 2006 : 11:54:39 PM
|
VS2005, C# When selecting some lines, pressing # does insert the #region pragma. With this build i see occasionally that the #region/#endregion is inserted in completely wrong locations, usually right after the ... class ... statement of the current class.
Or simply said: it messes it up badly. Not seeing any pattern in this behaviour. |
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Aug 26 2006 : 3:04:44 PM
|
do you have any idea of how often this goes wrong? i have just tried wrapping various blocks of code in #region #endregion using VS2005, C# and VA 1533. i have done this about 25 times up and down a cs file, with various sized blocks, and the only time anything odd happened was when i tried to wrap commented out code.
do you ever try to wrap commented out code? or anything else "odd"? if you did this 20 - 25 times would you expect to see it go wrong at least once? |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Aug 26 2006 : 3:51:53 PM
|
Cant really say, I've just added a bunch of new classes and added a region around similar parts of code. And in all cases I would just do the same mess. Restarting VS solved it although. Not sure what might be the initial cause. The code was not commented out, actually without any comments. And nothing special - contructor and data members. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Aug 27 2006 : 1:48:10 PM
|
do you have VA's enhanced colouring enabled? i am guessing yes. was it colouring things correctly in this new code? did you try the alt-m list, or next and previous context at any point before the restart?
if VA had not yet parsed the code this might make sense, but leaves us needing to work out why the code had not been parsed. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Aug 27 2006 : 2:53:57 PM
|
Coloring is enabled. new code was correctly colored, refactoring worked too (renamed some classes/symbols), next/previous i didnt use, too scared after seeing the mess it did
I guess it HAD parsed the code correctly - what i did, was "save as" of some classes the then rename them through refactoring. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 06 2006 : 1:55:07 PM
|
Sounds unrelated to coloring - more likely a timing issue, position info incorrect, etc. Not able to repro but have an idea about how to address it. case=2395
Can you describe the result more? You have a selection and expect it to be surrounded with a region. Does the selected text stay where it was? Or does it move? It sounds like the new text (the # lines) are put in the wrong place - but what happens to the original selection?
|
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 06 2006 : 2:41:29 PM
|
Original selection is unselected and text is unchanged, on the last active window, at the last insert position the mess starts, the end is where it would be in the original file, eg: 3 lines selected in file A will result in a region inserted in file B beginning at the last insert position, ending 3 lines below.
If the last insert position was in the middle of a line, it will insert the #region in the middle of the line.
I am not sure if its possibly related to changed checked-in files, that would be a possible source of problems: editing prompts to check out, check out will overwrite the file with the changed file, VAX gets confused with the changed contents. |
Edited by - Uniwares on Sep 06 2006 2:57:27 PM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 06 2006 : 2:51:03 PM
|
Thanks for the further info - didn't realize from the original description that multiple files were involved. |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 06 2006 : 3:07:11 PM
|
Tried it again. Seems to happen only when you save a copy of a file and rename the class. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 06 2006 : 3:14:44 PM
|
By rename are you talking about the VA Rename refactoring or doing a find and replace operation? |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 06 2006 : 5:29:47 PM
|
Since VA rename would also find the original class name and its references I do it with Find/Replace. |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Sep 06 2006 : 6:58:31 PM
|
Does the rename scenario cause it happen 100% or is it intermittent?
Here's what I tried to no avail: Open cs file. Do file save as and give new name. Ctrl+H to rename class in editor. Select block in middle of class and press #.
|
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 07 2006 : 6:02:27 PM
|
exactly what seems to trigger it for me. but its not consistent 100%. Happens in about half the cases I'd say. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Sep 09 2006 : 3:03:31 PM
|
using VS2005 professional and VA 1534 i have just tried the same test as Sean. to select the text i use the home key to make sure the caret is in the very first column and then use SHIFT + DOWN ARROW to select one or more lines of text. i them press # to surround them with #region #endregion
i have just done this to 21 different blocks in this newly saved out file. i did not save the file after doing the rename, and i did not save the file at any point while i was introducing the #region blocks.
every single block went in just fine.
am i doing anything obviously different?
i am starting to wonder if how you select the text matters. are you using the mouse of the keyboard? sometimes selecting "backwards", either from the bottom up or from right to left causes strange effects with VA enabled. perhaps that is what is going on here. it could explain the random element. |
zen is the art of being at one with the two'ness |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Sep 18 2006 : 2:44:27 PM
|
Uniwares: we believe the fix for the random behavior with surround selection is in build 1535. Can you try the build for a while and let us know what you discover.
case=2395 |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 18 2006 : 2:48:14 PM
|
Already running it. Lets see. |
|
|
|
Topic |
|