This is a much-needed extension, but has two major shortcomings:
1) You cannot tell the extension on which column to add the guideline. You kind of point to a place where it looks good and add the guideline there. You cannot tell it a column number. You could of course type out "1234567890" multiple times in an empty text line so you can right click in the precise place, but still...
2) You cannot remove a guideline until you restart VS2010. Minor annoyance, but you might want to add and remove guidelines until you find the good spot.
Overall, this is a much-needed feature. It just needs to be refined a bit.
A great job! A couple of things bear some refinement, though:
1. Folks who use TABs (0x09) for line indentation are out of luck, since you're apparently mixing char positions (string indices) with display columns.
2. Placing the new guideline exactly at the caret and not on the next column would look more natural. Probably another confusion between the 0-based strings and 1-based columns.
Thanks for the reports.
I'll have to look into #1. I thought I was extracting the column information correctly, but I must have missed this case. If in doubt, type a row of spaces, add the column where you want it, and then delete the spaces.
Yes, a number of people have pointed out that it feels more natural to have the guide appear where the insertion point (caret) is instead of "one to the right". When the caret is at column "n" (as indicated in the status bar), it is blinking just to the left of column n (between n-1 and n). Column guides appear to the right (between n and n 1).
My assumption was that you would use the column ("Col") indicator in the status bar to position the caret at the column where you wanted a guideline. For example, if you want a guideline at column 80, you'd move the caret until the status bar said "80" and then do "Add Guideline". This has the effect of drawing a guideline between columns 80 and 81. Yes, columns are 1 based, not zero based. This means it's not possible (and correctly so) to place a guideline to the "left of" column 1.
I can't seem to get your reasoning. It is possible to have the blinking cursor to the left of column 1, yet NOT possible to draw a dotted line over there? You are the one in control of the code, aren't you? Anyway, there's a quick and dirty solution: disallow tacking guides on the leftmost column, subtract 1 elsewhere.
People tend to think of a guideline like a tabulator, a boundary confining their text, rather than just a wacky off-by-one visual cue, ASCII art aside. We can't actually drag text with it like we do in Word -- OK, we'll tab through to the right position. Or am I missing the point entirely?
In the June 11th 2010 update, I have fixed the issue with tabs and I now allow addin or removing guidelines in column 1. You will need to update both extensions (Editor Guidelines and Editor Guidelines UI) to get the update.
Well done! It's working perfectly
Now, to share the goodness with the Power Tools package. People have been complaining about the tab issue there as well.
P.S. I just tried setting a proportional font in the editor to see how your new guides would cope. Man, I almost lost my jaw watching the column indicator change by 2 or 3 on each printable character %)
Obviously there's no easy solution in the nonprop case, but I guess a list of used guide positions might come in handy. Say, in the form of an optional grayed-out menu item like "@ 4, 8, 20". Or an ugly buhcn of "Remove guide at column N" items (just kidding).