-
Notifications
You must be signed in to change notification settings - Fork 14
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: handle_leading_whitespace seems to delete all whitespace (?) #159
Comments
Hmmm. it's very inconsistent |
I assume the code is all there in the otter buffer, so our Can you otter.nvim/lua/otter/lsp/init.lua Lines 142 to 144 in 5f03444
Maybe we are missing something. If this is not the case it is something harder to spot. I previously had issues with the other lsp servers like pyright being out of sync, see Lines 125 to 129 in 5f03444
What was happening there is as follows. Lsp servers don't actually look at the buffer (most of the time, for pyright we even disable it explicitly due to a bug https://github.com/jmbuhr/quarto-nvim-kickstarter/blob/6455ad9123041f11e3294508db8f216223e2ca8a/lua/plugins/lsp.lua#L288-L296) content. The client (neovim) sends a didOpen notification with the content of the buffer to the server and every time the content is changed it sends the changes over. In our case, we don't need to send these notifications, they get sent automatically by nvim when we change the otter buffer because pyright is attached to that buffer (that's mostly what being attached entails). But if for some reason one of these notifications gets lost the server gets confused. Just something to keep in mind in case nothing else makes sense.
|
What file do you experience the issue with and how do you activate otter? |
Here's the file: file
I activate it with a dev version of the Neorg otter integration, which is here. The relevant lines are: otter.activate(
module.config.public.languages, -- I have set to { "python", "lua" }
module.config.public.completion.enabled, -- true
module.config.public.diagnostics.enabled, -- true
nil
) The above integration is only providing user commands and making sure that |
I can print and inspect in a little bit, I've got a bunch of random stuff to do today, you don't have to look into this for now, I'll try to get a consistent reproduction |
Ok. As another test, it is always interesting if activating otter manually after opening a file makes a difference compared to an autocommand or ftplugin, to rule out races with other plugins (like in this case: #154 (comment) ). |
And while we are at it, I want to eventually take the |
Something else must be going on here. If I take your file and and just add an autocommand to activate otter for norg vim.api.nvim_create_autocmd({ "BufReadPost" }, {
desc = "Activate Otter on Buf Enter",
pattern = "*.norg",
group = vim.api.nvim_create_augroup("NorgOtter", {}),
callback = function(_)
require'otter'.activate()
end,
}) it just works. Same as activating manually. |
Btw. as you can see in the autocommand, you don't have to necessarily pass languages to otter.activate, it creates otters for all languages found (and for which it knows file extensions) by default. |
Neorg doesn't alter the buffer after opening. |
I'm unable to reproduce it in ~5 minutes of playing around with it. I'll reopen if I find a reproduction |
with 0 indent at all, it's fine:

With 2 space indent on both lines it's fine:

But with 0 leading indent on the code block itself, I do not get correct completions when I'm in an if block.

The text was updated successfully, but these errors were encountered: