Link to local file for permalinks in webview#8583
Open
Daniel-Aaron-Bloom wants to merge 2 commits intomicrosoft:mainfrom
Open
Link to local file for permalinks in webview#8583Daniel-Aaron-Bloom wants to merge 2 commits intomicrosoft:mainfrom
Daniel-Aaron-Bloom wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
alexr00
requested changes
Mar 11, 2026
| seq: originalMessage.req, | ||
| res: message, | ||
| }; | ||
| await this._waitForReady; |
Author
There was a problem hiding this comment.
For the same reason we wait in _postMessage above
protected async _postMessage(message: any) { // Without the following ready check, we can end up in a state where the message handler in the webview // isn't ready for any of the messages we post. await this._waitForReady; this._webview?.postMessage({ res: message, }); }
Author
There was a problem hiding this comment.
In practice without this, the extension simply fails to work about half the time in a dev container (never got a failure outside of the container). The await calls to get the file mapping simply never resolve (presumably because the message got dropped)
| seq: originalMessage?.req, | ||
| err: error, | ||
| }; | ||
| await this._waitForReady; |
Comment on lines
+24
to
+25
| function findUnprocessedPermalinks( | ||
| root: Document | Element, |
Member
There was a problem hiding this comment.
The approach of finding the permalinks in the webview involves multiple back-and-forths with the extension. I would suggest a different approach:
- In the extension (probably in issueOverview.ts or pullRequestOverview.ts)
- Find all the permalinks
- Check for file existance
- Replace permalinks with some very easy to find "tag" which contains all the relevant info
- In the webview
- Find this easy to find "tag"
- Parse the relevant info from it
- Replace with an
<a>who's on click handler uses the message passing (context.tsx) to open the relevant file
Author
There was a problem hiding this comment.
I can give that a shot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the functionality to link to a file within the project in a comment on the PR/issue overview pages. This feature creates parity with #5558, so links appear and function identically in both locations. It also enables users to quickly jump around using a list of referenced file locations in the PR description or a comment.
Fixes #8571
This PR also adds a few
await this._waitForReady;in_replyMessageand_throwError, which I think are the correct behavior, and also without them this extension sometimes fails to respond.