Open ykawakamy opened 3 months ago
Sorry not sure I understand. Do you mean using the icon for the webview tab ( #90616)? Or using the icon inside the webview content?
inside the webview content(in iframe).
I have created a demo of treeview with FileIcon on webview.
(tested it with the default seti
icon theme.)
https://github.com/ykawakamy/treeview-demo-extension
I have reimplemented processIconThemeDocument(toStyleSheet) , getIconClasses(resolveTreeIconClasses), and detectLanguageId.
If these become public APIs, we think we can adapt the webview design to vscode.
I think I have the same problem
I have a CodeSnap like extension with Windows window style. I wanted to add the file icon as a Window Icon, but there are no public APIs to do it in VSCode. I would like if there is a way to get file icons
Hey @mjbvz, this issue might need further attention.
@ykawakamy, you can help us out by closing this issue if the problem no longer exists, or adding more information.
Currently using FileIcon in extension webview requires a very complicated procedure.
Get the active IconTheme with
vscode.workspace.getConfiguration("workbench").get<string>("iconTheme")
.Scan vscode.extensions.all to find the active IconTheme extension.
Generate css rules from the active IconTheme. equivalent to processIconThemeDocument. It is necessary to set asWebViewUri of IconTheme as Uri of Font.
Set WebviewOptions#localResourceRoots to the on-disk URI of the active IconTheme extension.
Resolve Icon Class from Uri and ThemeIcon. equivalent to getIconClasses Currently, since the detectLanguageId is not public, it is possible to use
vscode.workspace.openDocument
as a substitute, but it is extremely slow.I would like you to provide the functions corresponding to processIconThemeDocument, getIconClasses, and detectLanguageId. Otherwise, add WebviewOptions#useFileIconStyleSheet. if set, FileIcon stylesheets to be automatically embedded in the webview like acquireVsCodeApi.
This issue is related to #191387, but there is no answer to Webview there.
-- Sorry, I'm not good at English.
This is off the topic but... , I'm somtimes confused Webview, WebviewView, WebviewPanel