Closed MrMic closed 1 month ago
Do you have any custom logic locally?
This has been raised earlier @MrMic. Not sure what's causing this, but I can't reproduce locally. All LSP's are up to date. Basic template + typescript pack.
What do you mean with "broken" @MrMic. Broken as in non-functional, or broken as in wrong formatting?
No custom logic. LSP is OK. The issue is with formatting, which does not work at all with JS / TS. All was working fine around 10 or 15 days ago. And then, I saw an update/upgrade and the formatting went wrong. And now, it is not working at all!
When I save JS file I got this notification error:
Error detected while processing BufWritePre Autocommands for "
Moreover when I install prettier in my project Dev Dependencies:
$> npm install --save-dev --save-exact prettier
and run:
$> npx prettier . --write
Everything works as expected... I mean formatted.
This is a significant issue. I am having the same problem, formatting completely broken in JS/TS.
I Wonder if this is due to prettierd
I think so. This bug happens when prettier was updated/upgraded a couple of days ago.
I'll take a look and try and debug this, but no promises on a timeline. Feel free to also investigate the issue and come up with a fix. I'm very pressed on times nowadays @Skarian @MrMic
Today I've updated AstroNvim and formatting was completely broken for all my TS projects. I have some easy repro steps:
create-next-app
with TailwindCSS (didn't test without)return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.tailwindcss" },
{ import = "astrocommunity.pack.typescript" },
}
src/app/page.tsx
file and save - everything will be finesrc/app/layout.tsx
and save - everything will be shifted to the line start.So the first file save is always ok, but the second is always shifting all the contents to the start of line.
Today I've updated AstroNvim and formatting was completely broken for all my TS projects. I have some easy repro steps:
- Start new app with
create-next-app
with TailwindCSS (didn't test without)- Create new AstroNvim config and add community packages:
return { "AstroNvim/astrocommunity", { import = "astrocommunity.pack.tailwindcss" }, { import = "astrocommunity.pack.typescript" }, }
- Go to
src/app/page.tsx
file and save - everything will be fine- Go to the next file
src/app/layout.tsx
and save - everything will be shifted to the line start.So the first file save is always ok, but the second is always shifting all the contents to the start of line.
Got the same issue!
@vadimshvetsov Feel free to help us in fixing this.
I removed the tailwindcss pack and reproduced the issue, so it looks like the problem is somewhere in the typescript pack. It looks like wrong formatting is produced by prettierd, and the weird thing is that the first opened and saved file will be formatted correctly.
We've already established that.
I checked the two latest commits to the typescript pack, and those didn't break anything
I saw the update of prettier a couple of days ago (10 or 15 days) and it was for the core of Astronvim not with the community packages. If I remember well. And from this point on I got issues with formatting.
I've rollbacked to my previous lock file and updated just astrocommunity to 8.5 and can't see any issue with formatting. I'll update packages one by one and will find which one causes the issue.
I've updated astrocore
and astrolsp
without any issue. But once I update AstroNvim
4.2
-> 4.7.5
I can see the issue. I'll figure out exact version next.
To those who are blocked by this issue, you can change either the version in lazy-lock.json
:
"AstroNvim": { "branch": "main", "commit": "0f875f4a7f1963d6c61eb564cadb8e556e406dd5" },
After opening nvim, just run :Lazy restore
, and it will pick up the last working formatting version.
Or directly set shiftwidth
back to 2
or 4
depending on preference before opening any file or in config.
This issue appeared right after the commit that came with AstroNvim 4.5.1: AstroNvim/AstroNvim@f3dbb86 (PR)
Wait. That shouldn't, if I'm thinking correctly, affect the prettier stuff
Prettier should override that anyways since it has its own prefered logic for tabs/spaces.
I've updated all my packages back to the latest and just put :set shiftwidth=2
- its working perfectly now for me 🤷♂️
Checked with latest create-next-app
also.
I guess prettier ignores tabWidth
setting somehow.
I think this just exposes an underlying issue with the prettier/prettierd and neovim.
Issue is upstream: https://github.com/pmizio/typescript-tools.nvim/pull/270
I notice an update but I still have no formatting and null-ls seems to get stuck at the bottom right corner of the UI.
Issue is resolved for me with a basic template + typescript pack. nothing else init.
I think this issue is proof that we should move away from typescript-tools.nvim to vtsls lsp instead.
This should be fixed now that we have moved to vtsls
. Let me know if this should be reopened.
Not OK for me! Sorry. null-ls seems to be stuck with prettierd
Make sure to update your dependencies @MrMic . It's working fine for me now
Make sure to update your dependencies @MrMic . It's working fine for me now
What do you mean by "dependencies"? All my packages are up-to-date.
I press "
Also open Mason and make sure to uninstall tsserver
Also open Mason and make sure to uninstall tsserver
I did it again. And it has been installed again but I still have the same issue... tsserver works perfectly fine, it is an issue with prettier(d) and formatting. One or 2 weeks ago I saw updates for prettier and since then I got issues.
Well you shouldn't see tsserver at all in the latest update 😅 so it shouldn't be working at all haha . Can you share an example project that's throwing the error and steps to replicate.
I see it when I open my project... Anyway, here it is: https://github.com/MrMic/NextJS-14-S04_NEW.git
BTW: When I work with VS Code on it I have no issue at all!
It would definitely be strange if you got a null-ls error message in vs code 😂
@MrMic delete your plugins and try again.
I.e the lazy cache folder
I.e the lazy cache folder
Where is it located? (on linux)
I've send you it before 😐
rm -rf ~/.cache/nvim
rm -rf ~/.local/share/nvim
rm -rf ~/.local/state/nvim
Also: List time you had a bug in a plugin, you "...deleted and reinstalled the plugin, and this solved my issue... weird." Whatever that meant, try that as well.
@MrMic I don't have any issues formatting that project, also it correctly only attaches vtsls
and eslint
, it doesn't add prettier
at all. Can you share your config? You might have a bug on your end
I've send you it before 😐
rm -rf ~/.cache/nvim rm -rf ~/.local/share/nvim rm -rf ~/.local/state/nvim
Also: List time you had a bug in a plugin, you "...deleted and reinstalled the plugin, and this solved my issue... weird." Whatever that meant, try that as well.
Done. But I still have this issue...
@MrMic I don't have any issues formatting that project, also it correctly only attaches
vtsls
andeslint
, it doesn't addprettier
at all. Can you share your config? You might have a bug on your end
I get a 404, that might be private
I get a 404, that might be private
Yes indeed. Should be public now for some time...
Ok, I found the error. Investigating now.
Ok, I found the error. Investigating now.
Seems to be a reccuring thing with your config @MrMic 😂
Ok @MrMic , AstroNvim v4.7.7 should resolve the specific error message you are getting, but there are still a lot of issues with your configuration. I will make a PR with a few fixes I found immediately, but I haven't really gone through it with a fine tooth comb
Ok, I opened a PR on your config. Hopefully it all makes sense. God speed!
Checklist
Neovim version (nvim -v)
0.10.0
Operating system/version
Linux Ubuntu 22.04
Terminal/GUI
kitty
Describe the bug
For a couple of days, the formatting with Javascript is broken. I think it is an issue with prettier and/or eslint. Everything is working with VS Code and Helix... I saw few days ago that prettier was updated/upgraded and this broke the formatting. Everything was OK before.
Steps to Reproduce
When I save a file, formatting failed
Expected behavior
formatting
Screenshots
see above
Additional Context
No response