You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to support variable substitution for the draw.directory setting like VSCode? Currently it does not support this feature. When I have "draw.directory": "${fileDirname}/attachments", this is the result:
Hey @Alecton4! Thanks for submitting this issue. I agree this would be a nice feature but I'm not sure it's currently possible. There's an open feature request for it upstream though: microsoft/vscode#2809
Found an unmaintained package that addresses this problem: vscode-variables (but doesn't work b/c the version of VSCode it depends on is too old)
So, I should say, this is possible to some extent. We could manually support a subset of these variables, for example. I'd agree that the one you've identified is probably one of the more useful ones.
Another option is to add a setting along the lines of draw.relativeTo: {workspace, file} which determines where the draw.directory value is appended to create an absolute path.
I gave this some more thought and feels like the best answer here (for your example, at least) is to make the directory relative to the current file by default. I've done that in the linked PR; feel free to add feedback there.
In the more general case of supporting variable substitution, we can add more broad replacements (similar to how it's done in the cmake tools extension); it's not entirely straightforward but not incredibly difficult.
Just for your information, this Markdown Paste extension seems to support predefined variables, many of which are the same as VSCode's ones. But they may not necessarily be retrieved from VSCode. I tested it and it works fine.
Since I'm not a JS/TS developer, I may not be able to help you much. But I hope Markdown Paste could provide you with some insights!
Activity
hall commentedon Feb 10, 2023
Hey @Alecton4! Thanks for submitting this issue. I agree this would be a nice feature but I'm not sure it's currently possible. There's an open feature request for it upstream though: microsoft/vscode#2809
hall commentedon Feb 10, 2023
Found an unmaintained package that addresses this problem: vscode-variables (but doesn't work b/c the version of VSCode it depends on is too old)
So, I should say, this is possible to some extent. We could manually support a subset of these variables, for example. I'd agree that the one you've identified is probably one of the more useful ones.
Another option is to add a setting along the lines of
draw.relativeTo: {workspace, file}which determines where thedraw.directoryvalue is appended to create an absolute path.hall commentedon Feb 18, 2023
I gave this some more thought and feels like the best answer here (for your example, at least) is to make the directory relative to the current file by default. I've done that in the linked PR; feel free to add feedback there.
In the more general case of supporting variable substitution, we can add more broad replacements (similar to how it's done in the cmake tools extension); it's not entirely straightforward but not incredibly difficult.
yttriumz commentedon May 8, 2023
@hall Thank you so much for your effort!
Just for your information, this Markdown Paste extension seems to support predefined variables, many of which are the same as VSCode's ones. But they may not necessarily be retrieved from VSCode. I tested it and it works fine.
Since I'm not a JS/TS developer, I may not be able to help you much. But I hope Markdown Paste could provide you with some insights!