mrlacey / CommentLinks

Add links between files in code comments
https://marketplace.visualstudio.com/items?itemName=MattLaceyLtd.CommentLinks
MIT License
31 stars 5 forks source link

CL 2.18 on VS 2022 "Include path to file" when True or False only includes the filename, not the path #60

Open markyoung2u opened 5 months ago

markyoung2u commented 5 months ago

VS 2022: Tools, Options, Comment Links, Include path to file can be true or false but nothing changes. The help indicates "if set to True, links generated with the context menu will include the path to the file." but it does not work for any of the 3 menu items. If I mark a word, right-click, Comment Links, Copy link to Selection, I get links without the path? link:work.txt:errorcodes link:smMsgs.h:errSelRsv

mrlacey commented 2 days ago

Looking at the current code, when this option is enabled, it tries to find the path relative to the project root. If it can't find the project the file is part of then it just outputs the file name. I guess a better option here would be to include the absolute (full) path if a relative one can't be determined.

Does that sound like a suitable solution?

markyoung2u commented 2 days ago

It would be better when "Include path to file" is True that the full path be used regardless of it being found in a project or not. Your code should be simpler, and would work as advertised. Right now it does not work. Doing it halfway is not really a solution, is it?

mrlacey commented 2 days ago

The details of why it was originally implemented (#4) the way it was are vague. Having absolute paths can cause potential issues with shared code bases as the code may be checked out to different paths or even different drives. Having absolute paths doesn't feel like a perfect solution as one of the original aims for this extension was to help people working with existing code bases that they're not familiar with and such people are more likely to be in a position where absolute paths don't help.

I'm going to do two things:

  1. Improve the explanation of the existing functionality.
  2. Add a new option to enable the creation of links that always use the absolute path to a file.
markyoung2u commented 2 days ago

OK, I understand, Seems fine