Exception has occurred: Error: Illegal argument: character must be non-negative
tjx666 opened this issue · 2 comments
tjx666 commented
I occur this exception when I debug my extension. It happen when execute the following code:
import vscode, { TextEditor } from 'vscode';
export default async function plur(editor: TextEditor): Promise<void> {
const json = await vscode.env.clipboard.readText();
const jsCode = json.replace(/"([^"]*)"\s*:/gm, '$1:');
editor.edit((builder) => {
const selectionText = editor.document.getText(editor.selection);
if (selectionText.length === 0) {
builder.insert(editor.selection.active, jsCode);
} else {
builder.replace(editor.selection, jsCode);
}
});
}
Version info:
Version: 1.51.1 (user setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19042
meganrogge commented
looking into this now
meganrogge commented
@tjx666 okay should be resolved in version 0.3.3