Activation fails with TypeError: Invalid host defined options
jcampolongo opened this issue · 12 comments
VSCode 1.82.2
OS: Windows 10 Enterprise
Version 10.0.19045 Build 19045
ANTRL4 Grammar syntax support v2.4.0
This is on a fresh install of the extension. The settings.json only has antlr values auto-created by the plugin when 'edit settings.json' is clicked in the settings tab.
The stacktrace:
2023-10-02 11:09:10.675 [error] Activating extension mike-lischke.vscode-antlr4 failed due to an error:
2023-10-02 11:09:10.675 [error] TypeError: Invalid host defined options
at codePointsToIntervals (.vscode\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:36280:66).vscode\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:36299:34)
at printableUnicodePoints (
at _SourceContext.initialize (.vscode\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:39143:43).vscode\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:40871:21)
at AntlrFacade.initialize (
at activate (.vscode\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:44295:21)\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:13032)
at Y.eb (
at Y.db (\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:12750)\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:107:6169)
at \Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:118:10857\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:107:6206)
at async E.n (
at async E.m (
at async E.l (~\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:107:5626)
The Developer tools shows:
mainThreadExtensionService.ts:113 Activating extension 'mike-lischke.vscode-antlr4' failed: Invalid host defined options.
$onExtensionActivationError @ mainThreadExtensionService.ts:113
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
w @ event.ts:1107
fire @ event.ts:1138
fire @ ipc.net.ts:650
X.onmessage @ localProcessExtensionHost.ts:585
This seems to be a pretty common error (just not in the extension here). Do you have a recent Node.js version installed?
Same issue here, all my vscode extensions are from the "Extension Pack for Java" microsoft extension, is this what you mean by Node.js version?
This seems to be a very recent thing, not sure whats changed
Here is the report from vscode 'about':
Version: 1.82.2 (user setup)
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:55:25.390Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
Searching for the error online reveals a pretty large number of victims and many times it has to do with the V8 node cache (which is not used in this extension) and ESM being used. I think the best option would be for you to install Node.js 20.x to make sure ESM is well supported, even though 18.18. is the recommended LTS version.
@Mblakey Go to the Node.js homepage and download the latest 20.x. release.
Updated to 20.8.0, problem still persists after restarting
Extension log file is pretty much identical to the one above
I do not separately install Node.js. Both Electron and Node.js are installed by vscode. I'm not sure how to upgrade Node.js such that Electron and thus vscode would use it instead of its own version.
I installed Visual Studio code insiders version and the antlr4 plugin (and only that plugin).
Version: 1.83.0-insider (user setup)
Commit: 4268e464763087044d0c1b5bdd37ebbe683cadfa
Date: 2023-09-29T20:42:50.630Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
I now get the following error during antrl4 activation.
2023-10-03 09:37:35.801 [error] Activating extension mike-lischke.vscode-antlr4 failed due to an error:
2023-10-03 09:37:35.801 [error] TypeError: Invalid host defined options
at codePointsToIntervals (c:\Users\jcampolongo.vscode-insiders\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:36280:66)
at printableUnicodePoints (c:\Users\jcampolongo.vscode-insiders\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:36299:34)
at _SourceContext.initialize (c:\Users\jcampolongo.vscode-insiders\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:39143:43)
at AntlrFacade.initialize (c:\Users\jcampolongo.vscode-insiders\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:40871:21)
at activate (c:\Users\jcampolongo.vscode-insiders\extensions\mike-lischke.vscode-antlr4-2.4.0\out\main.cjs:44295:21)
at q.ib (c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:13192)
at q.hb (c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:12914)
at c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:136:11039
at async v.n (c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:6205)
at async v.m (c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:6168)
at async v.l (c:\Users\jcampolongo\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:5625)
I then installed the WSL2 plugin and reinstalled the antlr4 plugin into the WSL2 environment (Ubuntu 22.04). There the plugin activates, but does not seem to be able to recognize my grammar. It shows 'No Rule Selected' when trying to perform any antlr4 plugin action
- Show Railroad diagram for rule/all rules
- Show ATN graph
- Show Grammar Call graph (this just shows a blank page)
- Generate valid input
Disabling the plugin and then enabling it then shows the plugin status as 'Not yet activated' with no error in the console, and nothing in the Developer Tools console either.
You have to save your grammar once while the extension is activated, which will generate interpreter data needed for all this functionality.
The note about the extension no being activated is indeed strange. I see that too, yet the extension works. No idea what's causing this strange (and obviously wrong) status.
I'm also experiencing this exact error and re-generating the interpreter data isn't helping. I've removed all java configuration and extensions, updated vscode and still none of this extension's features are working.
I also have the full grammar interpreter data generated under .antlr/. This functionality has never failed me. Also, the syntax coloring also works. So I get generated interpreter data (and Java files), and syntax coloring, but no other features of the plugin work.
@jcampolongo Let's see if we can get more information. Open the developer tools in VS Code (menu Help -> Toggle Developer Tools). This brings up a pane very much like what you see in a browser when opening the dev tools there. Go to the Console tab and scan through the messages there. You may have unrelated error messages (e.g. from other extensions). See if you can find any from the ANTLR extension only.
If in doubt close all open files and then close and reopen VS Code. At this point the ANTLR extension is not loaded yet. Open now the dev tools and clear the Console, to start fresh. After that open a grammar file and see what happens.
Oh gosh, I just followed my own advice and now I see this error too in the console, but the extension still works for me (which explains why I didn't look at the console before). This might indicate we have it to do here with 2 different issues.
New release is available.