
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
coc-webview
Advanced tools
Webview panel ported to coc.nvim
:CocInstall coc-webview
:CocList webview
Install the coc-webview to devDependencies
// import only type
import type { WebviewAPI, WebviewPanel } from 'coc-webview';
// fetch API
let webviewExt: Extension<WebviewAPI> | undefined;
const getWebviewAPI = () => {
if (!webviewExt) {
webviewExt = extensions.all.find((ext) => ext.id === 'coc-webview') as Extension<WebviewAPI> | undefined;
}
if (!webviewExt) {
const hint = 'Please install the coc-webview extension';
void window.showErrorMessage(hint);
throw new Error(hint);
}
return webviewExt.exports;
};
// create webview panel
export async function example(): Promise<void> {
const panel = await getWebviewAPI().createWebviewPanel(
// viewType
'markdown-preview-enhanced',
// title
`Preview markdown`,
{
// open in browser
openURL: true,
// route name
routeName: 'markdown-preview-enhanced',
},
{
localResourceRoots: [...],
enableScripts: true,
}
);
// update title
panel.title = 'Preview markdown-2'
// update html
panel.webview.html = '<html>...</html>'
// postMessage
panel.webview.postMessage({type: 'command', 'token': 'xxx'})
this.onDidReceiveMessage((msg: {type: string, token: string}) => {
// msg.type
});
cosnt util = getWebviewAPI().util;
util.openUri('https://domain.com/');
}
Usage: https://github.com/neoclide/coc.nvim/wiki/Using-the-configuration-file
webview.debug: Enable debug modewebview.colorStrategy: Color strategy for webviewwebview.primaryColors: Primary colors for webviewwebview.host: Listen host for webview servicewebview.minPort: Mix port for webview servicewebview.maxPort: Max port for webview servicewebview.openCommand: Command template for open webview, arguments(%u webview url), example: chrome "%u"MIT
This extension is built with create-coc-extension
FAQs
Vscode webview ported to coc.nvim
We found that coc-webview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.