-
Notifications
You must be signed in to change notification settings - Fork 182
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
bug: Blank line at EOF with powershell_es #274
Comments
No biggy. The main reason I was using |
Not sure if this is helpful in your situation but I could not get the LSP formatting to work with powershell_es. As a workaround, I'm using a custom formatter based on Here is my conform configuration: So far it's been fairly reliable, my only qualm is that it does not support Unicode characters, so no emojis or nerd font icons in scripts :( |
I have a suspicion about what is happening, but I'll need some more logs to confirm it. Could you format a small file that exhibits this error with |
I know this was originally raised for the PowerShell LSP formatter, but I'm having a very similar problem with the Bicep LSP with conform where new lines are inserted just before the final closing brace. For example, the file looks like this before saving: resource rgDeleteLock 'Microsoft.Authorization/locks@2016-09-01' = if (deleteLock) {
name: 'deleteLock'
scope: resourceGroup()
properties: {
level: 'CanNotDelete'
}
} After saving, it looks like this: resource rgDeleteLock 'Microsoft.Authorization/locks@2016-09-01' = if (deleteLock) {
name: 'deleteLock'
scope: resourceGroup()
properties: {
level: 'CanNotDelete'
}
} Then from the second save onwards there are two new lines at this position: resource rgDeleteLock 'Microsoft.Authorization/locks@2016-09-01' = if (deleteLock) {
name: 'deleteLock'
scope: resourceGroup()
properties: {
level: 'CanNotDelete'
}
} The resulting logs of three saves in a row on the example above:
Let me know if any further info is required. |
Thanks for the logs! This confirms my suspicion that it is related to the line endings. I've pushed up what I believe to be a fix. Could you give it a try? |
Brilliant! That's fixed it for the Bicep LSP. @MarcoBuess may be able to advise RE PowerShell. |
Will close as fixed. Feel free to re-open if issue persists |
Neovim version (nvim -v)
0.9.4
Operating system/version
Windows 10.0.19045
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Describe the bug
When using format on save, a new line gets added at EOF. Disabling
conform.nvim
and formatting withvim.lsp.buf.format()
doesn't show this behavior.What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
.ps1
fileformat_on_save
enabled.Expected Behavior
Code gets formatted but no new line added at EOF.
Minimal example file
Write-Output -InputObject "Hello, World!"
Minimal init.lua
Additional context
No response
The text was updated successfully, but these errors were encountered: