Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Webviews hosted inside custom editors (registered via vscode.window.registerCustomEditorProvider with a CustomTextEditorProvider) never execute any JavaScript — neither inline <script> blocks nor external script files. The HTML renders, but everything script-driven stays dead.
The exact same webview HTML works perfectly inside a regular webview panel (vscode.window.createWebviewPanel) in the same Cursor instance, so the issue is specific to the custom editor hosting path.
Impact: any extension that renders its UI through a custom editor appears frozen/static in Cursor (CSV/grid editors, PDF viewers, diagram editors, …).
Steps to Reproduce
Minimal extension (~40 lines, plain JS, no frameworks):
package.json:
{
"name": "csvtest",
"displayName": "CSV Test Grid",
"version": "0.0.3",
"publisher": "wuxusgames",
"engines": {
"vscode": "^1.70.0"
},
"activationEvents": [
"onCustomEditor:csvtest.grid"
],
"main": "./out/ext.js",
"contributes": {
"customEditors": [
{
"viewType": "csvtest.grid",
"displayName": "CSV Test Grid",
"selector": [
{
"filenamePattern": "*.csvx"
}
],
"priority": "default"
}
]
}
}
out/ext.js:
const vscode = require('vscode');
const fs = require('fs');
const LOG = 'D:/csvtest-alive.log'; // any writable path
function log(m) { try { fs.appendFileSync(LOG, new Date().toISOString() + ' ' + m + ' \n'); } catch (e) {} }
function activate(context) {
log('activate called');
context.subscriptions.push(
vscode.window.registerCustomEditorProvider('csvtest.grid', {
resolveCustomTextEditor(document, panel) {
log('resolveCustomTextEditor ' + document.uri.fsPath);
panel.webview.onDidReceiveMessage((m) => log('webview message: ' + JSON.stringify(m)));
panel.webview.html = '<!DOCTYPE html><html><head><meta charset='utf-8'></head>' +
'<body style='background:#fff;color:#000;font-size:28px;padding:40px'>' +
'<div id='s'>STATIC (no script ran)</div>' +
'<script>' +
' var el = document.getElementById('s');' +
' try {' +
' var vscode = acquireVsCodeApi();' +
' el.innerText = 'SCRIPT RAN (api ok)';' +
' vscode.postMessage({ command: 'alive' });' +
' } catch (e) { el.innerText = 'SCRIPT RAN (api failed: ' + e + ')'; }' +
'</script></body></html>';
}
}, { webviewOptions: { enableScripts: true } })
);
}
module.exports = { activate, deactivate() {} };
Steps:
- Package as a vsix and install it (
cursor --install-extension csvtest.vsix). - Create a file
test.csvxwith any content. - Open a new Cursor window, wait ~10 seconds (extension activation), then open
test.csvxfrom the explorer. - Observe: the tab shows
STATIC (no script ran)— the inline script never executed. The log file recordsactivate calledandresolveCustomTextEditor ..., but nowebview messageever arrives.
Already tried: explicit webviewOptions: { enableScripts: true } (also without it, since VS Code enables scripts implicitly for custom editors); with and without a CSP meta (script-src 'unsafe-inline'); full app restart; verified the extension activates and resolveCustomTextEditor runs. A regular createWebviewPanel panel with identical HTML works fine (scripts run, messages flow).
Expected Behavior
Per the VS Code custom editor docs, custom editor webviews should behave like normal webviews and execute scripts when enabled (this is how real VS Code behaves). In Cursor the custom editor webview stays script-less.
Operating System
Windows 10/11
Version Information
Cursor 3.24.12
Commit: 37b865941ccb31e2fc90c685157534efca87f960
x64
(also reproduced on Cursor 3.21.18, Windows 10 x64 10.0.26200)
Additional Information
Not AI-related — this is an extension-host webview issue. Happy to provide the packaged vsix or any further diagnostics if useful.
Does this stop you from using Cursor
No - Cursor works, but with this issue