neorg
neorg copied to clipboard
@code block highlighting not working with parsers that have an underscore in the name (like c_sharp).
Prerequisites
- [X] I am using the latest stable release of Neovim
- [X] I am using the latest version of the plugin
Neovim Version
0.9.1
Neorg setup
local M = {
"nvim-neorg/neorg",
lazy = false,
event = "VimEnter",
build = ":Neorg sync-parsers",
dependencies = {
{
"nvim-lua/plenary.nvim",
},
{
"nvim-neorg/neorg-telescope",
},
},
}
M.opts = {
load = {
-- Core Features
["core.defaults"] = {},
-- Make things readable.
["core.concealer"] = {
config = {
folds = false,
icon_preset = "basic",
},
},
-- Manage workspaces.
["core.dirman"] = {
config = {
workspaces = require("neorg-workspaces").workspaces,
default_workspace = require("neorg-workspaces").default_workspace,
},
},
-- Kebindings. Actual mappings should be defined in mappings.lua
["core.keybinds"] = {
config = { -- Custom User Keybinds
default_keybinds = true,
neorg_leader = require("mappings").neorg_leader,
hook = require("mappings").neorg_bindings,
},
},
-- Table of Contents
["core.qol.toc"] = {
config = {
close_after_use = true,
},
},
-- Telescope integrations.
["core.integrations.telescope"] = {},
},
}
function M.config(_, opts)
require("neorg").setup(opts)
end
return M
Key mappings can be found here and treesitter conf can be found here.
Actual behavior
When entering a code block, if the language has an underscore in the name (there might be more cases but I'm not sure), the code block will not show highlighting on that block. This is most easily demonstrated with C#.
Using cs
:
- No highlighting.
- Opens Looking Glass buffer as expected.
- Looking Glass buffer has highlighting.
Using c_sharp
:
- No highlighting.
- Opens Looking Glass buffer as expected.
- Looking Glass buffer doesn't have highlighting.
Error when opening looking glass for first time: Looking glass gives an error when opening for the first time. Unsure if this is related but it happens regardless of what language I'm using in the code block.
There are other errors I get at random times with Looking Glass. I'm mostly sure these are unrelated, though.
Expected behavior
- @code blocks to show correct highlighting with languages involving an underscore (especially C# as this is, in this case, the language I need).
- The language tag used for the @code blocks should be consistent in that they match the name of the parser used for that code block. (In this case it would mean I'd be using
c_sharp
as this is the name of the TS parser for C#.) They should still open Looking Glass buffers correctly.
Steps to reproduce
- Create a code block (either manually or with the snippet) and use either
cs
orc_sharp
for the tag. - Write some code.
- Open a Looking Glass buffer for it.
Potentially conflicting plugins
None that I'm aware of.
Other information
This issue was discussed in the #neorg
chat in Discord. Messages can be found here.
I tried this with git_config
parser as well with same issue.
If you add additional underscores in the language tag, it will capture whatever the last word is after the final underscore. E.G: foo_bar_dee
would capture _dee
. I'm not 100% sure of this but it appears that way based on highlighting.
Help
No
Implementation help
If there is some way I can contribute I'll try but I don't really have time to currently between work and university.
Same issue, no solution yet?