-
Notifications
You must be signed in to change notification settings - Fork 34
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
[feat] add C/C++ support #5
Comments
sure! I can see what I can get this working with, just starting to get familiar with Treesitter. AndrewRadev/splitjoin.vim#33 (comment) |
just from a quick view, progress would require support for multiple also, there is a crash, its hard to explain how to reproduce, but it might be a missing bounds check which can just be patched:
|
Later, I'll look at the tree structure that the treesitter gives. I think that there should be no problems for c/c++ support. |
Can you open a separate issue and send a code, preset and cursor position where you call a plugin? |
I agree, some of the use cases are very easily implemented: cpp = {
parameter_list = treesj_utils.set_preset_for_args(),
argument_list = treesj_utils.set_preset_for_args(),
initializer_list = treesj_utils.set_preset_for_list()
},
ill keep looking at this, adding more cases as I find time and use. EDIT: the above config works for:
void test3(int a, int b, float c) {}
---
void test3(
int a,
int b,
float c
) {}
test3(1, 2, 3.0f);
---
test3(
1,
2,
3.0f
);
std::vector<int> table = { 1, 2, 3, 4, 5 };
---
std::vector<int> table = {
1,
2,
3,
4,
5,
};
|
@ViRu-ThE-ViRuS, send a code (block where you call plugin) too, please |
In the first fragment, it is a binary expression. I don't think what is the best way to format it with treesitter (because it is binary inside binary). But I also think, how implement this, but not in TreeSJ. About this, not sure. In my todos I have task to adapt TreeSJ for split/join blocks without brackets, but here separator stay before named nodes. I'll keep that scenario in mind for future development. |
For the first fragment, it would make sense if clauses within if (a && b || c) {}
---
if (
a &&
b ||
c
) {} NOTE: One would prefer to have the first clause on the first line, and the last clause inline with if((a && b) || c) {}
---
if (
(a && b) ||
c
) {} If these groupings can be handled correctly by TreeSJ, it would be an amazing addition. |
hey! amazing work on this plugin, works very well for me in some of the languages I have tested it on!
I wanted to request support for C/C++ as well, as it would be very useful and the fact that there are very few options (if any) for these languages for this level of functionality. I am aware that it might be a complicated endeavor (as suggested by discussions in
splitjoin.vim
plugin), but its good to start a new discussion.I think it would be a great addition to this plugin, and will attract many more devs and appreciation!
The text was updated successfully, but these errors were encountered: