-
Notifications
You must be signed in to change notification settings - Fork 1k
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: Treesitter and LSP not loaded when editing new file #169
Comments
If you edit the {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
}, should do the work. Just put the above in a spec under your |
yeah, that should work. or just |
You should also configure the same for |
yeah I think all my metions before should be concerned. |
I just tried |
Yeah, it’s up to maintainers, however I would never say that editing a new file with fully feature support is "just my personal use case". |
When I edit a new file as you describe, then treesitter does attach. Am I missing something here? Lsp servers only attach after you saved the file and then reload it What difference does the |
I didn't know about this LSP limitation. Good to know. This renders |
In my experience, adding the |
yes...treesitter does attach, think I have accidentally opened a file that does not have the ts parser when I'm testing. Treesitter will be loaded due to
When I'm testing this, using
2023-02-07.10-27-40.mp4 |
Damn, I always thought that was a limitation of lspconfig, so thank you for this! Just updated all events to include Everything now indeed seems to work for new files as well! |
Glad you fix it!👍👍 |
…use BufNewFile. Fixes LazyVim#169
…use BufNewFile. Fixes LazyVim#169
Did you check docs and existing issues?
Neovim version (nvim -v)
0.8.1
Operating system/version
Ubuntu 22.04
Describe the bug
When you edit a new file (e.g.
nvim newfile.lua
), treesitter and LSP will not be loaded, and I think it's becausetreesitter
andlsp-config
are lazy-load withBufReadPre
orBufReadPost
.In Neovim docs, it says
BufReadPre BufReadPost starting to edit an existing file
.Shouldn't editing a new file behave the same as editing an existing file?
The same situation also exists with these plugins:
gitsigns
,indent-blankline
,mini.indentscope
,null-ls
,persistence
,todo-comments
,vim-illuminate
Steps To Reproduce
nvim newfile.lua
Expected Behavior
Editing a new file behaves the same as editing an existing file.
Repro
The text was updated successfully, but these errors were encountered: