Bug fixes

I took a little break from the Markdown work to fix a few bugs and annoyances in my other extensions.

Go To Definition

Go To Definition on github.

Updated Go To Definition on VSGallery.

There were two known issues with this one. The first was reported by a user, Craig Gidney, who noticed that you can't ctrl-click on an identifier if there is either a breakpoint or a "highlight references" marker over the token.

The other is an issue I noticed while using the extension in my normal work, which is that you can't activate a smart tag with ctrl-. (period) if your mouse happens to be over a token that is underlined.

The underlying cause of both of these turned out to be the same, which is that the logic in the classifier was causing spurious and constant layouts when the mouse was moving over the token that was already highlighted. The change was a simple one; if the classifier is asked to highlight a new span, it doesn't do any work if the old and new highlight spans are the same.

You can view the diff on github, if you want to see specifically what I mean.

Triple-click

Triple-click on github.

Updated Triple-click on VSGallery.

This one comes from Chris Dias, who is the Group Program Manager of the Visual Studio Platform team (he's basically chief PM of all the PMs that I work with). He noticed that triple-click in most other applications selects the a line and the line break, whereas this extension doesn't include the line break. That means that if you select a line and then press delete/backspace or cut, it wouldn't actually get rid of the line (in the sense that you'd want). He also noticed that it just seemed to not work sometimes, though he had no idea how he got into the state.

In addition to the bug fixes, I wanted to add drag support, to select whole lines at a time after you've clicked (and held the mouse down). Most other applications support those, though some (like IE) have some strange line-select/word-select hybrid once you start dragging. For most other applications, it works like word-selection, where the original word/line remains highlighted as the "anchor" of the text you are selecting.

The first change was really easy; ITextLine has two properties for the extent of a line: Extent and ExtentIncludingLineBreak. All I had to do was switch from using the former to the latter.

The second fix was also easy, once I realized the (very dumb) logic error I had made. Note to self and everyone else – when computing the coordinates of the mouse relative to an IWpfTextView, make sure to add the ViewportTop, not subtract it.

Drag support wasn't too bad, either. I added handlers for mouse move and left button up (for tracking the state of a drag that started with a triple-click), and then wrote a little piece of logic for determining the extent of the drag, making sure to always include the original line that was selected.

I also took this opportunity to create an icon and screenshot for this extension. I'll be writing another article in the near future about icons and screenshots, as I just went through and updated all of them (though haven't uploaded the changes quite yet for everything).

Here's the diff for the first bug fix and the drag support, if you are curious. Here's the diff for fixing the dumb logic error and the new icon/screenshot.

Updating

If you haven't already, I'd advise turning on the automatic updating logic in VS, which you can find under:

 Tools->Options->General->Environment->Extension Manager->Automatically check for updates to installed extensions

Also, if you want to see all the extensions I've installed, you can search directly in the extension manager for Noah Richards. So far, I have five: Triple Click, Go To Definition, Gradient Selection, Italic Comments, and Fix Mixed Tabs (the newest one). I run all but Gradient Selection locally (I don't mind the flat selection, and I'm using VS inside a VM running on my laptop, so I appreciate the quicker selection model). My extensions page has more information about each.

And last but not least – if you find bugs in any of these extensions, please let me know in the comments. No guarantees that I'll get things fixed in a timely manner, but I do read every email and comment sent my way.