Skip to content

Conversation

@gjsjohnmurray
Copy link
Contributor

This PR fixes #174690, handling the case where the CommentAuthorInformation.iconPath uri uses the file scheme (for example, to specify an avatar that is bundled with the extension).

gjsjohnmurray added a commit to gjsjohnmurray/vscode-extension-samples that referenced this pull request Feb 19, 2023
@gjsjohnmurray
Copy link
Contributor Author

Modified comment-sample at https://github.com/gjsjohnmurray/vscode-extension-samples/tree/show-iconpath uses GitHub (https) avatar for first comment, then embedded image for second.

For the embedded icon it uses file:// uri unless extension.extensionKind is Workspace, in which case it sets scheme to vscode-remote and authority to vscode.env.remoteName. See https://github.com/gjsjohnmurray/vscode-extension-samples/blob/c9ec78c3bcc67d52cd493ad4e0514aa459fdfd8f/comment-sample/src/extension.ts#L26-L31

@gjsjohnmurray gjsjohnmurray marked this pull request as ready for review February 19, 2023 08:21
@gjsjohnmurray
Copy link
Contributor Author

For the embedded icon it uses file:// uri unless extension.extensionKind is Workspace, in which case it sets scheme to vscode-remote and authority to vscode.env.remoteName. See https://github.com/gjsjohnmurray/vscode-extension-samples/blob/c9ec78c3bcc67d52cd493ad4e0514aa459fdfd8f/comment-sample/src/extension.ts#L26-L31

@alexr00 ideally the extension wouldn't have to do this itself, but I haven't found a way of getting it done automatically.

@gjsjohnmurray
Copy link
Contributor Author

ideally the extension wouldn't have to do this itself, but I haven't found a way of getting it done automatically.

Just pushed a change that does this.

@alexr00
Copy link
Member

alexr00 commented Feb 24, 2023

@gjsjohnmurray thanks for the PR! There's some logic somewhere that will automatically transform the URI if we send it from the extension host to the renderer as a URIComponents. The problem here is that the URI is being toStringed when it gets converted to a data transfer object 🙈.

The best fix would be to make it a URIComponents so that it get's automatically transformed. If you'd like to make a PR with this change then please do! Otherwise, I'll fix it myself in the next couple weeks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments API - How can author.iconPath reference a file bundled with the extension?

2 participants