-
Notifications
You must be signed in to change notification settings - Fork 352
adjustable indent (experimental) #621
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
Conversation
mxw/vim-jsx#116 (comment) thanks to @mxw for the suggestion
@sassanh please test this out, ive made the changes you wanted |
here is a small demo |
@bounceme thank you, that was fast. It's alright overall though there are some minor issues. Look at this:
While rest of expressions are reasonable and can be considered they're following a rule, last parenthesis is inconsistent. |
that is because a continuation is started. the previous line ended in a parenthesis. |
What's a "continuation"? Is it a JS construct I'm not aware of? |
not really, |
I agree with @sassanh that
is not a "correct" indentation—I don't know of any style guidelines (save perhaps the most bizarre Python styles) where this is recommended. I think I empathize more with the difficulties of trying to maintain a cobbled-together pseudo-parser—but I don't think that implementation details are a good justification for behavior. |
(I don't know the vim-javascript codebase at all, though, so for all I know this is prohibitively difficult to implement.) |
https://github.com/pangloss/vim-javascript/blob/master/indent/javascript.vim#L83 is the extent of this 'pseudo parser' . I won't be removing line continuation, though you can with the config variables https://github.com/pangloss/vim-javascript/blob/master/indent/javascript.vim#L63 |
It could be changed to only happen in blocks(not in object literals, arrays, args), as with cindent |
This is another issue I found with this branch:
|
are you sure that isn't an issue with jsx only? |
It happened after I checked out this branch, I'm sure it was working correctly in |
as this is the javascript repo, could you please reduce this to a reproducible js only example? |
#621 (comment) |
I just hope after you're done with it, it doesn't affect experience with |
Another issue:
last line should have indent width 0. |
thats unrelated, lines that start with |
I see, you're right, it happens in |
#621 (comment) |
Very nice, this latest commit made it much better. I continue testing and will share any problem I find here. |
A minor issue:
The ternary if in backgroundColor is not indented at all. Though I'm totally cool with its current indentation just thought it helps to report it. |
that contradicts #621 (comment) |
|
I see, it's alright the way it is. |
I don't know about that, I don't think so. But look at this:
double indent. |
fixed |
Didn't find any other issues with this branch. Checked it with ~2000 lines of js and jsx code. |
A really minor issue is it somehow tries to indent commented lines too :D
But I guess it's not relevant to these commits. |
that is an issue with mxw/vim-jsx isn't it? i can't reproduce with ft=javascript |
since they are so prone to user error, and they aren't so needed now I'll add a deprecation warning in the readme |
I found an issue:
|
Oh, right, my bad. |
What about this:
|
my results:
|
Yeah I got latest |
Are you using a variable to keep some state for indentation? After using it a while it will start indenting things like this #621 (comment) Like indenter didn't clean a variable or something like that. |
Yes, though it will never do things like that because it is used only in very specific circumstances. I did just fix something though which would cause some problems with the cache |
OK, I will tell you if I see it again. |
yea, only versions after 22d0e64 had the problem |
Nice, it's much more stable after your latest commits. I can't even find minor issues. Good job. |
If there were any jsx bugs found here, you might report them at mxw/vim-jsx so they get recognized |
It happened again, in a vim session that was open for few hours, indentation went wrong. After restarting vim it worked alright. |
so what do i do with that information? the conditions absolutely prevent that from happening, my guess is jsx |
Yeah, I know that information is not helpful. Just though maybe it triggers something for you. I try to find out how to reproduce it. |
Well I have noticed jsx changing indent when repeatedly indenting |
Next time it happens I'll check a js file with
|
mxw/vim-jsx#116 (comment)
thanks to @mxw for the suggestion, it is slightly less useful than the cindent version though