tree-sitter-python icon indicating copy to clipboard operation
tree-sitter-python copied to clipboard

Simplify try statement, accept missing else/except/finally

Open maxbrunsfeld opened this issue 5 months ago • 10 comments
trafficstars

This makes the parser more useful for editors, since the try_statement will still be identified, even if it's incomplete.

maxbrunsfeld avatar May 28 '25 00:05 maxbrunsfeld

If you update the parser to ABI 15, you also need to update the bindings to match (tree-sitter init --update).

clason avatar May 28 '25 09:05 clason

  1. Apparently the package-lock.json is out of date? Try npm update and commit the result. (Also cargo update for good luck.)
  2. You are using a(n outdated) distro build of tree-sitter CLI that strips the commit info. Either use a cargo build from the v0.25.5 tag of a local checkout, or add generate: false to the parser-test-action step.

clason avatar May 28 '25 15:05 clason

I'm using the latest version of Tree-sitter CLI via cargo install tree-sitter-cli. That should be a supported workflow. This build sha thing is not helpful right now.

maxbrunsfeld avatar May 28 '25 16:05 maxbrunsfeld

I'm using the latest version of Tree-sitter CLI via cargo install tree-sitter-cli.

Didn't you just release a new version? ;) It looks like you're using a distro build of v0.25.4 (distro I'm guessing, but the version is right there in the diff.)

clason avatar May 28 '25 16:05 clason

Didn't you just release a new version?

Yeah, but the same error occurred before that; the problem is that you don't get a BUILD SHA apparently if you cargo install.

maxbrunsfeld avatar May 28 '25 16:05 maxbrunsfeld

(I do agree FWIW; it can be useful info but in combination with the overbearing workflows it's obnoxious.)

clason avatar May 28 '25 16:05 clason

I get the good intention behind failing the build if the parser changed, but combined with the build sha thing, it's causing problems. It's nobody's fault, just observing some pain points that have arisen with Tree-sitter because of a few good ideas combining badly.

maxbrunsfeld avatar May 28 '25 16:05 maxbrunsfeld

Maybe the workflow can ignore the first line of that diff (git diff |tail -n +1); that would sand off the sharpest edges here.

clason avatar May 28 '25 16:05 clason

https://github.com/tree-sitter/parser-test-action/issues/6

clason avatar May 28 '25 16:05 clason

(Not a maintainer here so I can't push to your PR; otherwise it'd be an easy fix for me.)

clason avatar May 28 '25 16:05 clason

nice!

amaanq avatar Sep 11 '25 04:09 amaanq