Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: golang fmt.Errorf %w missing type #1

Open
2 tasks done
topi314 opened this issue Jun 27, 2024 · 2 comments
Open
2 tasks done

bug: golang fmt.Errorf %w missing type #1

topi314 opened this issue Jun 27, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@topi314
Copy link

topi314 commented Jun 27, 2024

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263)

Describe the bug

when parsing golang fmt.Errorf("failed to bla: %w", err) the parser reports that the format type is missing.

From what I can tell this is caused by https://github.com/tree-sitter-grammars/tree-sitter-printf/blob/main/grammar.js#L45 the w in the size field.

Steps To Reproduce/Bad Parse Tree

  1. parse %w with printf

Output:

(format_string [0, 0] - [0, 2]
  (format [0, 0] - [0, 2]
    (size [0, 1] - [0, 2])
    (type [0, 2] - [0, 2])))
format.txt	   0.06 ms	    34 bytes/ms	(MISSING type [0, 2] - [0, 2])

Expected Behavior/Parse Tree

%w gets correctly parser as

(format_string [0, 0] - [0, 2]
  (format [0, 0] - [0, 2]
    (type [0, 1] - [0, 2])))

Repro

  1. create file format.txt:
%w
  1. run tree-sitter parse format.txt
@topi314 topi314 added the bug Something isn't working label Jun 27, 2024
@ObserverOfTime
Copy link
Member

I'm not sure how to fix this without breaking sizes. PR welcome.

@ObserverOfTime ObserverOfTime added the help wanted Extra attention is needed label Jun 28, 2024
@topi314
Copy link
Author

topi314 commented Jul 1, 2024

i have no idea how to fix this either, in the meantime I am running a fork with w removed from size field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants