microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.35k stars 28.6k forks source link

Search in markdown preview panel not working in current main branch local build #222244

Open manav014 opened 1 month ago

manav014 commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes

Type: Bug

I recently build vscode on local with following configuration and last commit being https://github.com/microsoft/vscode/commit/61b242c67f23d24bcb9abb25bcac223547f032bd .

Version: 1.92.0
Commit: Unknown
Date: Unknown
Electron: 30.1.2
ElectronBuildId: undefined
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0

I found that the search functionality is not working for markdown preview. Seems like a recently introduced issue as when I tried to perform the search operation in stable release I was able to search across markdown preview.

Steps to Reproduce:

  1. Preview a Markdown file
  2. Search for any keyword present in markdown file.
  3. You will see that it won't show results.

This bug could be pushed with next release and can cause issues with upcoming stable releases.

PFA: POC video for the issue.

https://github.com/user-attachments/assets/0bb47435-cbc0-4e56-a821-61d59c2db412

Would be great if @mjbvz , you can shed some light here.

dangerman commented 1 month ago

When trying to search in a Markdown Preview whilst debugging, the code does hit WebViewMainService.findInFrame(): https://github.com/microsoft/vscode/blob/709c3d756947c2c275bf90a87a071eca58453851/src/vs/platform/webview/electron-main/webviewMainService.ts#L50-L59

However, frame.findInFrame is undefined so it just skips the rest of the function - and this appears to be why it's not working.

Now, according to this issue https://github.com/microsoft/vscode/issues/201176 Microsoft uses a custom build of electron (from https://github.com/microsoft/vscode-electron-prebuilt that is not publicly accessible) for VS Code releases, with a WebFrameMain.FindInFrame() implementation, so searching works.

The intention seems to be that changes are gradually upstreamed into the main electron repo, but unfortunately the PR for the FindInFrame stuff is Closed for the time being: https://github.com/electron/electron/pull/28274

Perhaps if we're able to merge the branch from that PR into an updated local build of electron, then we could use it with our vscode for debugging? 🤔