Open linguini1 opened 9 months ago
I haven't read through your whole description yet
I just saw that it's about neorg not being loaded when previewing files in telescope
This might be because iirc we use a BufEnter *.norg
autocommand or something like that which propably isn't called when previewing files with telescope
I'm not sure how recent your neovim version is but couldn't this be fixed with the filetype detection for norg now being in core?
I haven't read through your whole description yet I just saw that it's about neorg not being loaded when previewing files in telescope This might be because iirc we use a
BufEnter *.norg
autocommand or something like that which propably isn't called when previewing files with telescope I'm not sure how recent your neovim version is but couldn't this be fixed with the filetype detection for norg now being in core?
That's correct. I'm skeptical it's just an issue with the auto command though because even once the buffer is opened,
highlighting still breaks. It's also broken if I :checkhealth nvim-treesitter
before opening a .norg file.
My Neovim version is NVIM v0.10.0-dev-1031+gc431d820e
, so I'm not sure if the filetype issue you mentioned applies.
well perhaps just try updating to latest nightly and see if the issue is still there
well perhaps just try updating to latest nightly and see if the issue is still there
I am using the latest nightly
then it should have the filetype thing so that's also not fixing it https://github.com/neovim/neovim/pull/24948
Prerequisites
Neovim Version
NVIM v0.10.0-dev-1031+gc431d820e
Neorg setup
Actual behavior
When I open a .norg file from my file-tree or using the
:Neorg
command, syntax highlighting is added as expected. However, when I open a .norg file using Telescope, although Neorg is then loaded, syntax highlighting does not appear as expected. If I then try to open a .norg file in any other method, syntax highlighting remains broken.https://github.com/nvim-neorg/neorg/assets/62850091/29cc1e87-2131-46ab-aa4d-2618868c20dc
Expected behavior
Since
lazy.nvim
can load Neorg on filetypes ofnorg
, I'd expect since the Telescope buffer preview shares that filetype, it would load the parser in time to see the preview. I would also expect that since thenorg
andnorg_meta
parsers are already installed, treesitter parsing should work without Neorg having to first be loaded. Finally, I would also assume that once Neorg has been loaded (by opening a.norg
file from Telescope'sfind_files
picker), treesitter parsing would then be loaded and work for subsequently opened files.Steps to reproduce
See the video in "Actual behaviour".
You will need to have the same lazy-loaded Neorg setup as shown above.
Alternatively, to see situations where the syntax highlighting works:
Telescope find_files
::e
or:Neorg workspace ...
Telescope find_files
, and observe that syntax highlighting works as expected everywherePotentially conflicting plugins
I think this is caused by
filtype
not being properly set when Telescope opens a buffer in the preview window.I also think it's plausible that this is simply caused by the way I am lazy-loading Neorg on
ft=norg
, but that does seem to be supported in the docs. I wish there was a way for the tree-sitter parsing to work in the preview window of telescope without the hacky autocommand workaround.Other information
:checkhealth nvim-treesitter
before loading Neorg.:TSEnable highlights neorg
when syntax highlighting fails with no lucknorg
parser shows up as having no capabilities until Neorg is loaded.norg_meta
also doesn't show up in:checkhealth nvim-treesitter
until Neorg is loaded.Checkhealth before Neorg is loaded
Checkhealth after Neorg is loaded
Help
Yes, but I don't know how to start. I would need guidance (check question below)
Implementation help
I had a look at the codebase to see if I could find somewhere where the norg treesitter parser is enabled, since I assume it's only being enabled when Neorg is loaded or something similar. I couldn't find anywhere where that happens, and I am not sure where else to look to try to solve this issue.