-
Notifications
You must be signed in to change notification settings - Fork 45
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
Indentation not correct when in block #27
Comments
I can't confirm that. Indentation works fine for me. Are your Vim settings correct? The file ps1.vim in \indent\ sets the smartindent. Try enabling/disabling the Vim's indent options to isolate the problem. |
I couldn't repro this either. |
I think the OP may be referring to the indentation when |
Thanks @anthony-geoghegan. The original post is also edited to make the point clearer. |
If someone knows how to fix this and wants to submit a PR, I'm happy to merge if scenario testing passes. |
@heaths you mention scenario testing, are there unit tests we can populate with failing scenarios? If not, would you accept a PR for some unit tests perhaps utilizing Vader? #18 (closed, not pulled) does not have this specific issue. However, both smartindent used by this project and #18 have other issues like not working with herestrings, block comments, breaking on lines after a closing brace (i.e. the line after a param block), getting confused with backslashes in strings and other issues. Unfortunately, I'm not all that familiar with the way the indent code works, but I'd be happy to have a crack to see how far I can get, but I'd be happier if we had a test of tests that people agreed on that I could chip away at getting to passing. |
Idk if this is still being worked on, but I'm having the same issue as OP. |
@fretep, we do not have tests currently but Vader at a glance seems fine. I just meant for someone to go through the broken scenario and make sure it works, and make sure - at least with basic testing - nothing regressed. I test out the PRs before merging typically, but it's good to test at both ends. The person who submitted #18 closed the issue themselves since it didn't work as expected in scenarios they tested. @sethcenterbar, we will happily accept PRs to fix this behavior. |
Not a a great solution, but if you add a semicolon to the end of each powershell line, then So in the example by @randomizedthinking you would need to change it to this:
Definitely not ideal, but it works. |
I also had a similar problem, which is that automatic indentation of the closing brace was bad when typing (I'm using auto-pairs also, which inserts these automatically). And I confirm this is due to having Removing that line fixed the issue for me. I rather set that according to filetype now. |
I had similar problem and removing |
The indentation of the powershell script is not correct when in braces blocks. For instance, the following lines are correct:
While, if they are inside a pair of braces, when use
=
to indent the code block, the outcome becomes:The text was updated successfully, but these errors were encountered: