cursorless-dev / vscode-parse-tree

Syntax trees for VSCode using tree-sitter
MIT License
40 stars 35 forks source link

Html / xml parser can't handle tags with names longer than 10 chars #49

Closed chfritz closed 7 months ago

chfritz commented 1 year ago

Due to https://github.com/tree-sitter/tree-sitter-html/issues/30

I'm using this extension inside of my sane-indentation extension and after upgrading vscode today to 1.71.1 I now get:

[Extension Host] LanguageStillLoadingError: Language 'javascript' is still loading; please wait and try again
    at getTreeForUri (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/out/extension.js:192:27)
    at getNodeAtLocation (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/out/extension.js:206:24)

Any idea where this is coming from and how to fix it? Do you need to publish a new version or did something break in your recent commits?

chfritz commented 1 year ago

Update: for some reason this is not happening in all my workspaces only in one, and I haven't yet figured out why there and nowhere else. But when I reload the window of that workspace I also noticed this error:

[Extension Host] stack trace: TypeError: Cannot read properties of undefined (reading 'apply')
    at e.<computed> (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:10533)
    at wasm://wasm/0005dc02:wasm-function[555]:0x14a0a
    at e.<computed> (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:10533)
    at wasm://wasm/0005dc02:wasm-function[531]:0x147a1
    at e.<computed> (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:10533)
    at wasm://wasm/0005dc02:wasm-function[515]:0x144ed
    at e.<computed> (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:10533)
    at wasm://wasm/0005dc02:wasm-function[366]:0x13533
    at wasm://wasm/000afe02:wasm-function[217]:0x245ba
    at Module._ts_parser_parse_wasm (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:20088)
    at Parser.parse (/home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/node_modules/web-tree-sitter/tree-sitter.js:1:35207)
    at /home/cfritz/.vscode/extensions/pokey.parse-tree-0.21.2/out/extension.js:93:43
chfritz commented 1 year ago

I think I've narrowed it down: the errors only occur when I have an HTML file open among my editors!

pokey commented 1 year ago

Interesting! Maybe worth trying the tree-sitter cli with the tree-sitter-html parser on the html file to see if it hangs?

chfritz commented 1 year ago

I haven't tried that yet, but I've narrowed it down further: it only happens when the said html file is already open when the window (re-)loads and the HTML contains web components, aka. custom tags.

pokey commented 1 year ago

Ah interesting! Do you have an example? I tried an html file with web components, and although it didn't parse correctly, it didn't seem to affect other documents in the workspace

chfritz commented 1 year ago

Here is the file. And as a reminder: after you've opened it, you need to do a "Developer: Reload Window" to trigger the bug.

<html>
<head>

</head>

<body>
  <script src="http://portal.homedesk.local:8000/running/@transitive-robotics/webrtc-video/dist/webrtc-video-device.js?userId=cfritz&deviceId=f5b1b62bd4"></script>
  <webrtc-video-device
  id="cfritz"
  host="homedesk.local:8000"
  ssl="false"
  text="/dev/video0"
  timeout="1800"
  source="/dev/video0"
  type="v4l2src"
  width="320"
  height="240"
  framerate="15/1"
  bitrate="20"
  />
</body>
</html>
RedCMD commented 1 year ago

Caused by <webrtc-video-device ... />

For some reason it cannot handle tags that are over 10 chars long <abcdefghijk> will break it, but <abcdefghij> wont

pokey commented 1 year ago

Fwiw here is the issue to track the >10 chars thing https://github.com/tree-sitter/tree-sitter-html/issues/30

pokey commented 7 months ago

fixed by 6317e9198e38bdb478f44f16f5d2cc4ff3a80ad8