-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add field names #106
Add field names #106
Conversation
@nicolas-guichard tests are failing on CI |
Indeed, I found the reason for the test failure: When _type is defined as:
then
But when _type uses a named field around the
then
I don't really understand why adding a named field changes the precedence here.
I've removed the named field as a workaround for now, but I'm wondering if it would make sense to remove the optional type_modifiers from not_nullable_type to make the grammar less ambiguous. |
@nicolas-guichard This is a bit concerning as we might potentially miss a similar test case. I guess we can't name fields of different types without creating a wrapping node. I've looked at this issue where field names were introduced. tree-sitter/tree-sitter#271 What I would suggest doing is instead of adding all possible fields right now. Start smaller instead with only a couple of fields you need BUT additionally updating unit tests to verify fields are correctly named in every single place. |
d4ea76a
to
ed1f640
Compare
I'm mainly interested with elements that can have an inner block, so I've done those (+ This is split into commits that should each pass the tests for easier reviewing, but, given that |
@nicolas-guichard I'm not concerned about splitting this in multiple commits since it'll get squashed anyway. Thanks for adding the tests! If you can rebase on master I'll re-run tests and merge |
ed1f640
to
81db7e0
Compare
This reverts commit 0ef8789.
We really need to get the parser size under control again... this PR bumped it from 22 MB to 70 MB. The Git CLI warns about it too:
|
I've reverted this PR for now. Feel free to rebase and open a new PR, but please make sure to keep the parser at a reasonable size, ideally < 30 MB, and also that the CI checks pass (specifically #92). |
Hi,
This is a continuation of /pull/74 given Vladimir Reshetnikov said they would not be pursuing it anymore.
In Searchfox, we leverage tree-sitter to add some information on where symbols are found. For instance if you search for the C++ symbol mozilla::dom::MediaControlKeySource::IsOpened, and you find 9 results in the file
dom/mediacontrol/MediaControlKeyManager.cpp
, it's super useful to know in which function each result was found (tree-sitter is what enables those// found in
comments). We are adding Kotlin support to Searchfox, hence this PR.For now we only use the
name
andbody
fields ofclass_definition
andfunction_declaration
, but since there was a pull request hanging around to add named fields everywhere I just rebased it on main.If you think it's too much (this adds almost 2M lines to
parser.c
!), I can reduce the number of named fields. They could be useful to someone else though.