Friday, April 10, 2020

Comment Links - v1.1

Version 1 only shipped yesterday but there's a new version already.

Version 1.1 includes three changes:


  • The ability to support file and path names containing spaces. (including if they're URL encoded)
  • Support for search terms that include spaces
  • Indicating when a file can't be found (in the status bar). This also includes line numbers that don't exist or search text that can't be found.


These changes are the result of issues submitted on GitHub. Please raise any other feature requests there ;)


  • There was also a bugfix relating to navigating to the line containing the search text.


Download and enjoy.

Stay safe.


Thursday, April 09, 2020

Navigate between files of different languages in Visual Studio

Visual Studio has great tooling for navigating within code when it is in the same (programming) language.
However, if your solution contains code in more than one language and you want a quick way to navigate between files you're out of luck. Until now!

Presenting: Comment Links
Yes, it's (another) new Visual Studio 2019 extension. This one lets you put links between files anywhere in your code. In theory, this could be anywhere in your code, but in comments makes the most sense. Just include the text `link:` (case-insensitive) followed by the file name.


A green button with an arrow on it will, when clicked, open the named file.

You can also have the file open on a specific line by including the line number after `#L` at the end of the file name.

// link:mapManager.js#L25

 Or you can jump to the first occurrence of a specific piece of text

// link:mapManager.js:UpdateLocalData

For compatibility with text fragment anchors you can also use `#:~:text=` after the file name to specify the text.

// link:mapManager.js#:~:text=UpdateLocalData


Version 1.0 is in preview and available from the Visual Studio Marketplace now.
Please give it a try and tell me what you think or suggest new features on GitHub.


This project was the result of a comment from one of my GitHub sponsors. If you join them I'm likely to take any suggestions you make more seriously. ;)

Thursday, April 02, 2020

Automatically collapse code comments when opening a document

I've just released a new version (1.2) of my Collapse Comments extension for Visual Studio.

Amongst the changes are two new configurable options.


Whether using (or imports in VB) directives are collapsed as well as comments is now configurable. This is the old behavior and so is enabled by default.

The other new option is the ability to automatically close comments whenever a new document is opened. This is off by default as it's a change in behavior.

Please let me know what you think of these changes, or, even better, leave a review :)


Monday, March 23, 2020

Open URLs in the error/warning description

It can be more effort than it feels necessary to navigate to a URL in a message description.

To get to it you might type it into a browser, or more likely, copy the whole message and then copy the URL and then paste it into a browser.

But, you're a busy developer. You have better things to spend your time on than unnecessarily cutting and pasting URLs that you can't easily open.

What you need is a way to open that URL in a browser without all the faff.

Congratulations, you're in luck. I've just updated my Error Helper extension to enable just this scenario.


After you install the extension, you can simply right-click on the entry in the error list and select Open URL. I'm sure you can guess what will happen then ;)
What could be simpler?

And for the avoidance of any doubt, the other options highlighted above will copy the description of the selected entry into the clipboard or search for the description in your default browser.

If you haven't already go install it now.

Don't just take my word for it, here's what others have said.





Thursday, March 19, 2020

Controversial idea: Get rid of the XAML Image tag

Here's an idea I've had swimming around in the back of my brain for a while. I've not yet settled on it 100% yet, but when I do, I'll start some proposals, and discussions with the appropriate people/organizations/repositories.

This is me writing down my ideas to help better think them through and for those of you who come across this page to have a chance to share your thoughts.


Let's get rid of the <Image /> tag!

I acknowledge that this is a potentially controversial idea and it would be a BIG change to a lot of people but I think it has the possibility to advance XAML based development in two important areas: semantics and accessibility.

Semantics
I'm increasingly persuading myself on the benefits of improving the intent of written XAML. Having a generic image tag only communicates that an image should be displayed but provides no information about how that image is used within the UI. This is far from optimal. Alternative/replacement controls could do a better job of communicating intent and aiding the readability of the code.

Accessibility
The vast majority of XAML based apps that I've seen make little or no regard for accessibility support and how screen-readers work with images in apps created with XAML. While HTML and the web are far from perfect, they do a much better job of encouraging people to use "alt" tags on their images. As accessibility and inclusive design continue to grow in importance and consideration for all users of all software, I expect an increased need for XAML based UIs to be asked to do a better job in the coming years.


How would we get rid of it?
In an ideal world, I'd mark it deprecated and then rename it (to BaseIamge) and make it abstract. I'd then add tooling to indicate it shouldn't be used and a suitable replacement is used instead.
The tooling part is easy (:wink:) but the other parts would cause A LOT of compatibility issues. I'd settle for introducing alternatives and recommending they are used instead. I don't really expect to be able to change the current Image tag.

What I propose we have instead

I propose adding two new controls to replace (or be used instead of) the current one: BackgroundImage and ContentImage.

BackgroundImage
This would support an image source and be almost identical to the current Image control. The difference would be that this would never show up in accessibility tools. It's just a background, so it doesn't matter if some users of the software don't know about it. The name also communicates to future developers that this is just part of the background and shouldn't host anything important like the content.

ContentImage
This would be like the existing Image control but also add a required description property. The value assigned to this property would be made available to accessibility tools so that anyone using the app but unable to view the image wouldn't miss out on important content information.
The description could also be used as a fallback if the image couldn't be used, similar to how alt text is displayed on websites when images don't load.
Tooling could easily be added to check that this property is set and a suitable (non-empty) value is provided.

I might have missed something obvious but I think almost all uses of images in apps could be classified as background or content.

That's it. It's quite simple.

  • Stop using Image.
  • Use BackgroundImage for visuals that aren't important and only part of the visual aspect of the page.
  • Use ContentImage for pictures that do contain important information that should be communicated to the user even if they aren't able to view the image.



As this is the internet, feel free to tell me why I'm wrong, what a silly idea this is, and the obvious things I've overlooked. ;)