Registering Multiple Extension Files #295
-
Hi, I created an extension for icons and this is my main file: import { registerExtension, ExtensionHostKind } from "vscode/extensions";
import { IExtensionManifest } from "vscode/vscode/vs/platform/extensions/common/extensions";
const extension: IExtensionManifest = {
name: "vsc-material-theme",
publisher: "Philipp Kief",
version: "4.32.0",
engines: {
vscode: "*"
},
contributes: {
iconThemes: [
{
/* @ts-ignore */
id: "material-icon-theme",
label: "Material Icon Theme",
path: "./material-icons.json"
}
]
}
};
const { registerFileUrl } = registerExtension(extension, ExtensionHostKind.LocalProcess);
registerFileUrl(
"/material-icons.json",
new URL("./material-icons.json", import.meta.url).toString()
);
registerFileUrl(
"./icons/folder-root-open.svg",
new URL("./icons/folder-root-open.svg", import.meta.url).toString()
);
registerFileUrl(
"./icons/javascript.svg",
new URL("./icons/javascript.svg", import.meta.url).toString()
);
registerFileUrl(
"./icons/typescript.svg",
new URL("./icons/typescript.svg", import.meta.url).toString()
); If I don't specify a path for each file individually, it gives an error. Since the icon file is json, of course I can read the file and add it in the loop, but I wanted to ask: Can I use it without specifying all the required files individually? Maybe something like: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You'll need your bundler to generate an url (probably hashed) for each asset. You'll also need to call registerFileUrl for each file. What you can do is using a plugins like https://www.npmjs.com/package/rollup-plugin-glob-import maybe and looping by hands on the result You can also use the provided rollup plugins |
Beta Was this translation helpful? Give feedback.
You'll need your bundler to generate an url (probably hashed) for each asset.
You'll also need to call registerFileUrl for each file.
What you can do is using a plugins like https://www.npmjs.com/package/rollup-plugin-glob-import maybe and looping by hands on the result
You can also use the provided rollup plugins