Add custom (per-link) images?
Request from the marketplace:
- Use custom images for the links.
If done:
- The same image for all links?
- What image format(s)?
- How specify the image to use?
- What other image considerations are there? e.g. size & auto-scaling?
- What about text, rather than an image?
X-Ref #51
If done:
- The same image for all links?
- What image format(s)?
- How specify the image to use?
- What other image considerations are there? e.g. size & auto-scaling?
- What about text, rather than an image?
I would like to see individual images. One way I use images is for types (classes, functions, etc...) See Screengrab below.
As for formats i'm not particular. I would think the usual suspects however svg would be nice. If not (I suspect that would be difficult) png, jpg, and bmp. Maybe ico?
Specifying the image perhaps could be a defaulted argument using a parser character.
Link:{ImageFile,[Option1,...]}:JumpLocation:DisplayLabel. With No ImageFile just fallback to the default Maybe allowing a option in settings to specify the default image. With no options just scale to a size set in the settings dialog? Some options could differ based on the image type. For example changing the image color for svg files (if possible). Another option could be to use an image list in settings. User adds images to the list and can assign a name or number. Also an option to collapse the display down to just image and text (maybe even hide the comment starter i.e. // or /*)
Some examples:
Displays a struct type image with the text label "Goto Structures" Image foreground color is black. //Link:{MyStructImage,Width=128,Height=128,ClrFG=RGB(0,0,0)}:v:"Structures Used in this file":Goto Structures"
Jumps to "Text in this file" using first image in image list (or second if 0 based lol). Also uses default size or perhaps the image actual size? //Link:{1}:"Text in this file"
Just text based links would also be a great idea. It would be nice to display them the same way you would an "<A h ref>" link. With a text decoration option such as hover, visited color ... It could use the Image section except have an option for text.
//Link:{"Textual link",type=text|image} You could make no options default to text. In this way the first parameter can be a textual link, An image from an iml (specifying type=image), Could even use the same param for predefined jumps
//Link:{"GoTo Top",option=Jump-Top|Jump-Bottom|Jump-Next|Jump-Prev}: ...
I'm not really sure how possible any of this actually is and I'm certain it will be a lot of work. I'm glad you are considering it though. As it stands CommentLinks is already one of the more productive extensions I use.
The current implementation uses text for the arrow "icon". Using a text character (including emoji) would be a lot simpler than dealing with separate image files and could be specified inline
I'm not quite sure what you mean. Does that mean the images would be predefined and one would choose an image via particular characters?
Inspired by your suggestion of something like link:[path/to.img]:filename.ext
What about something like link:docs/filename.ext[📖] ?
This would use the book emoji instead of the arrow. (To better indicate it's a docs link.)
In the same file, you could also have link:filename.ext[✅] to show a link to a [unit] test.
Or link:filename.ext[>] if you just wanted the GreaterThan sign. (Doesn't have to be an emoji.)
Exact syntax to be determined, but I prefer the character at the end of the string so it's less intrusive and doesn't make the file path harder to read.
Additionally, could also make the default/fallback character to use configurable.
Yes that sounds good. The only real reason I suggested custom images was because of the way I document various code. For example I have it setup as an Objects main page then additional pages for Constructors, Methods, Properties, etc... Which is of course the images I would like to use unless there's a means to use VS's built in images. i.e. Link:filename.ext[vs.method] or similar.
I still say collapsing down to just an image and a label would look best. For example link:docs/filename.ext[📖] collapses to
📖Documentation
The collapse would be unhidden when the cursor is placed inside the label or on the image for example. When moved away (via mouse or kbd) it re-collapses. Not the most important thing but it would definitely look cleaner.