Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support relative path variable substitution in SugarCube 2 macro definition descriptions #137

Closed
JustNoon opened this issue Aug 1, 2023 · 1 comment

Comments

@JustNoon
Copy link
Contributor

JustNoon commented Aug 1, 2023

Having a relative path for markdown images or links would help create nice documentation for local projects. Clickable links, previewable images, etc.

In VSCode, description pop-ups are in a restricted context that doesn't support relative paths.

exampleicon:
  name: exampleicon
  description: "![Example](icons/example.png)"

returns some sort of absolute path depending on environment (i.e. "vscode-file://vscode-app/c:/icons/example.png")
All . / .. relative path indicators are stripped as well (probably for a good reason, maybe not though).

Adding full support for a relative path might introduce the same security blindspot VSCode is avoiding but a couple replacement strings would go a long way into adding more feature-rich descriptions while not having to deal with VSCode's protocol shenanigans.

description: "![Example](%workspaceFolder%/icons/example.png)"
description: "![Example](%definitionFolder%/example.png)"

An alternative solution to this would (and probably the correct one) would be to pass the macroDefinition's description as a MarkdownString so you can set baseUri as the current path.

@JustNoon
Copy link
Contributor Author

Closing as merge effectively handles cases for this

JustNoon added a commit to JustNoon/twee3-language-tools that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant