Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

feat(v): add queries #34

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

feat(v): add queries #34

wants to merge 3 commits into from

Conversation

ttytm
Copy link

@ttytm ttytm commented Apr 17, 2023

No description provided.

@HiPhish
Copy link
Owner

HiPhish commented Apr 17, 2023

I get an error at the root node of the test file:

ERROR [0, 0] - [42, 1]
  ERROR [0, 7] - [41, 32]
    simple_identifier [0, 7] - [0, 11]
    simple_identifier [0, 14] - [0, 22]
...

@ttytm
Copy link
Author

ttytm commented Apr 17, 2023

Hey thanks for taking care if this. Looks like i was sloppy there. I'll check on it asap 👍

Sorry about the inconvenience.

@ttytm
Copy link
Author

ttytm commented Apr 18, 2023

Main problem I've forgot about is that vim sets the ft for files with a .v to verilog. For V it needs to be user set. I'd still need to improve the test but I'll submit the upstream support first then come back to this. Making this draft for now.

@ttytm ttytm marked this pull request as draft April 18, 2023 12:29
@HiPhish
Copy link
Owner

HiPhish commented Apr 18, 2023

Main problem I've forgot about is that vim sets the ft for files with a .v to verilog. For V it needs to be user set.

Don't worry about that, it's outside the scope of this project. Anyone who uses V will already have adjusted the file type detection, and those who have not don't use V anyway.

@ttytm
Copy link
Author

ttytm commented Apr 21, 2023

Hey @HiPhish,

I updated the test to include code that actually compiles. It's still code that doesn't make a lot of sense. Sorry again about the miss in the initial PR.

Can you tell me how you run your tests? I haven't found anything in either the readme or the contribution file. Unfortunately, I have fairly little time to find out by doing my own investigation. Then I would be happy to adapt to further needs 👍

@HiPhish
Copy link
Owner

HiPhish commented Apr 23, 2023

Can you tell me how you run your tests?

I open the test file manually, then I open the Tree-sitter playground and check whether everything looks correct. It's not very efficient, but queries rarely change, so it's not a big deal. Still, it would be good to automate the process, especially for testing strategies.

Neovim 0.9 has introduced vim.inspect_pos(), so now I can at least programmatically check the highlighting. With that I could use a testing framework to write automated tests. I have used in the past Vader, but it is flawed in that tests are all run in the same instance as the test framework itself. We would need a test framework that spawns a fresh Neovim per test so that failure or crashes in one test don't bring down all other tests. And first-class support for Lua (and maybe other languages?) of course.

@HiPhish
Copy link
Owner

HiPhish commented Apr 24, 2023

I am still getting parser errors.

Screenshot_20230424_110336

@ttytm
Copy link
Author

ttytm commented Apr 28, 2023

Thanks for you message @HiPhish. Totally fine to do it that way. And now, I know what to look at!

But I don't get the parsing errors. Could it be that it's because of a wrong filetype when you entering the .v file?

I submitted proper filetype detection the vim just about last week or so. Meanwhile it also made it into vim. Are you using nightly?

rb2.mp4

@HiPhish
Copy link
Owner

HiPhish commented May 13, 2023

You are correct, I had the file type Verilog set, my bad. It would be a good idea to add a little modeline comment at the end of the file to set the file type explicitly when there is any possibility of ambiguity. See :h modeline. I did the same in the test file for the query file type (test/highlight/query/regular.scm) to ensure that it is not interpreted as Scheme instead.

Anyway, I have now looked into it and there are a number of node types I don't see in the tree:

  • parenthesized_expression
  • type_cast_expression
  • special_argument_list
  • comptime_selector_expression
  • multi_return_type
  • fixed_array_type
  • exposed_variables_list
  • slice_expression
  • attribute_declaration
  • empty_literal_value
  • select_expression
  • map (there is map_type in the tree)

Am I missing something again?

@ttytm
Copy link
Author

ttytm commented May 29, 2023

No you are right again @HiPhish. I didn't added all of the node types in the test file. I'll update it in the coming week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants