nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.32k stars 209 forks source link

@code block highlighting not working with parsers that have an underscore in the name (like c_sharp). #984

Open NiamhFerns opened 1 year ago

NiamhFerns commented 1 year ago

Prerequisites

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#.

image image

Using cs:

Using c_sharp:

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.

image

There are other errors I get at random times with Looking Glass. I'm mostly sure these are unrelated, though.

Expected behavior

Steps to reproduce

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.

silberlu commented 4 months ago

Same issue, no solution yet?