Vscode-r: Help view: search functionality

Created on 23 Nov 2020  路  5Comments  路  Source: Ikuyadeu/vscode-R

Is your feature request related to a problem? Please describe.
Search for words, code snippets, etc. in a manual opened by HelpView

Describe the solution you'd like
Add an icon to the top of the panel which opens a search field if clicked. If the user starts typing, highlight the matching elements in the content of the view, and let the user step through the hits.

feature-request

All 5 comments

This would definitely be nice to have, but quite difficult to implement cleanly, I think.

Since webviews behave similar to separate websites, we cannot use vscode's integrated search features in the help panel, but would need to implement our own search functionality.

If anyone knows how to do this cleanly or has alternative ideas, please let me know :)

My understanding is that a WebView is basically an HTML content within an iframe-like context, so

  1. As you described, we can not use vscode's integrated search features, but
  2. We can run any javascript within the HTML.

So we could inject a CDN reference to e.g. mark.js, a JavaScript keyword highlighter library. Or is it more involved?

That sounds like it should work. Integrating mark.js in the help panel might take some effort, since communication between the webview and the rest of the vscode-extension is limited to postMessage() commands and access to local files/other resources is somewhat limited.

Would you be interested in working on this? I probably won't get around to doing this myself, but I'll be happy to help, if you want to give it a go :)

OK, I can give it a try. However, it will not happen soon; I will let you know if I make some progress with it.

Just after implementing my own solution based on mark.js, I found a trivial way to add this functionality: there is an option "enableFindWidget" in WebviewPanelOptions.

@ManuelHentschel , can you please take a look at the PR (#488)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kalaschnik picture Kalaschnik  路  4Comments

JimmyZJX picture JimmyZJX  路  3Comments

Dee-L picture Dee-L  路  5Comments

renkun-ken picture renkun-ken  路  6Comments

michaelHL picture michaelHL  路  5Comments