sansarip / owlbear

An experimental Visual Studio Code extension that supports paredit-like structural-editing features for HTML, TypeScript, TypeScript-React, JavaScript, and JavaScript-React.
https://sansarip.github.io/owlbear/
MIT License
36 stars 2 forks source link

Extension not working - bad export type for `tree_sitter_typescript_external_scanner_create` #107

Closed brdloush closed 1 year ago

brdloush commented 1 year ago

Describe the bug Extension doesn't seem to work at all.

To Reproduce Steps to reproduce the behavior:

  1. Install extension
  2. create new html file, try to invoke paredit-like actions, nothing happen. Even if I use ctrl+shift+p and look those actions up, they don't work

Expected behavior It should work.

Desktop (please complete the following information): Ubuntu 22.04LTS

vscode:

Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:47:05.613Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.19.0-42-generic
Sandboxed: Yes

Additional context Just after launch, I can see following error messages in the code

mainThreadExtensionService.ts:80 [sansarip.owlbear]abort(Assertion failed: bad export type for `tree_sitter_typescript_external_scanner_create`: undefined). Build with -s ASSERTIONS=1 for more info.
$onExtensionRuntimeError @ mainThreadExtensionService.ts:80
mainThreadExtensionService.ts:81 RuntimeError: abort(Assertion failed: bad export type for `tree_sitter_typescript_external_scanner_create`: undefined). Build with -s ASSERTIONS=1 for more info.
    at cn (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:58070)
    at T (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:55860)
    at kn (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:63802)
    at f (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:61833)
    at vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:62102

...

mainThreadExtensionService.ts:80 [sansarip.owlbear]abort(Assertion failed: bad export type for `tree_sitter_tsx_external_scanner_create`: undefined). Build with -s ASSERTIONS=1 for more info.
$onExtensionRuntimeError @ mainThreadExtensionService.ts:80
mainThreadExtensionService.ts:81 RuntimeError: abort(Assertion failed: bad export type for `tree_sitter_tsx_external_scanner_create`: undefined). Build with -s ASSERTIONS=1 for more info.
    at cn (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:58070)
    at T (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:55860)
    at kn (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:63802)
    at f (vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:61833)
    at vscode-file://vscode-app/home/myuser/.vscode/extensions/sansarip.owlbear-1.1.2/dist/extension.js:2:62102

Then, after invoking any paredit-ish action:

 ERR Cannot read properties of null (reading 'children'): Error: Cannot read properties of null (reading 'children')
    at e.ExtHostCommands.h (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:98:125669)
    at e.ExtHostCommands.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:98:126218)
    at a.N (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:110:11620)
    at a.M (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:110:11338)
    at a.H (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:110:10431)
    at a.G (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:110:9412)
    at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:110:8200
    at v.invoke (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at h.deliver (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at g.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14852)
    at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:126:32403
    at v.invoke (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at h.deliver (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at g.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:72:14852)
    at MessagePortMain.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:126:30529)
    at MessagePortMain.emit (node:events:513:28)
    at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367)
sansarip commented 1 year ago

Sorry about this! Rookie mistake on my part; I didn't test on OS's other than macOS 🤦‍♂️ Yea, it looks like Windows users will have similar issues. I'll try and fix it later this evening.

PEZ commented 1 year ago

I have this on MacOS too. Let me know if/how I can help with any investigation!

sansarip commented 1 year ago

Thanks @PEZ!! Are you running on intel or M1?

jdhuntington commented 1 year ago

I have the same error on osx with an M1.

sansarip commented 1 year ago

Barnacles! Looking into why this is occurring, seems like this might be relevant: https://github.com/tree-sitter/tree-sitter-typescript/issues/244.

PEZ commented 1 year ago

M1 here as well.

brdloush commented 1 year ago

Don't know if it's worth mentioning or not.. but I just realized while hacking in different project in vscode that owlbear actions are actually working correctly (!!!) :+1: for me while editing typescript .tsx files. Still when I create just a simple .html file, it doesn't work there. So it seems that the extension integration isn't fully broken :thinking:

sansarip commented 1 year ago

Update, the underlying TypeScript and HTML Tree-sitter WebAssembly files are breaking with the current version of VS Code (1.78.2) [TSX still works though for some reason] 😢 I believe this is because VS Code v1.78.2 upgraded its Electron to 22.5.2, and now VS Code's Electron/Node is not playing nice with Tree-sitter's WASMs!

This VS Code release and the corresponding Tree-sitter issues are all incredibly very recent, and unfortunately, after much experimentation and research, I'm not sure of a clear path forward ATM!

This could be another reason to port the core logic of Owlbear to LSP. But, I'm pretty new to LSP, and I'm not sure how flexible LSP is when it comes to supporting custom commands like the ones Owlbear provides (e.g. slurp, barf, etc.). Anyway, while I'm waiting for progress from Tree-sitter folks on the above issue, I'm going to think through alternatives to loading WASMs in VS Code.

I'll try and put out a patch that'll extend the working TSX support to TS/JS, and then I'll sunset HTML support for now until I figure out a path forward.

Sorry for the inconvenience folks!

PEZ commented 1 year ago

Afaiu you can implement those commands with an LSP server. clojure-lsp has a few paredit commands, like drag sexpr and such.

sansarip commented 1 year ago

OK, so I was able to find a way around the errors [they're still there, just non-blocking]. I'll probably still explore LSP, but for the time being, the just-released Owlbear v1.1.3 should work as expected on HTML, JS, TS, JSX, and TSX files!

Still have some issues on Windows, but I have a separate issue open for that.

Please let me know if this issue is still persisting!