Skip to content

Strange behavior for vue depending on config #120

@MartenBE

Description

@MartenBE

Minimal reproducible full config

When commenting ts code in a Vue file, the following config works OK:

require("lazy").setup({
    'JoosepAlviste/nvim-ts-context-commentstring',
    {
        "nvim-treesitter/nvim-treesitter",
        build = ":TSUpdate",
        config = function()
        require('nvim-treesitter.configs').setup {
            ensure_installed = "all",
            auto_install = false,

            highlight = {
                enable = true
            },
            indent = {
                enable = true
            },
        }
        end,
    },
    {
        'numToStr/Comment.nvim',
        opts = {
            pre_hook = function()
                return vim.bo.commentstring
            end,
        },
    },
}, {})

When changing from config to opt for nvim-treesitter, commenting lines in the ts section happens with <!-- --> instead of //?

require("lazy").setup({
        'JoosepAlviste/nvim-ts-context-commentstring',
        {
            "nvim-treesitter/nvim-treesitter",
            build = ":TSUpdate",
            opts = {
                ensure_installed = "all",
                auto_install = false,
    
                highlight = {
                    enable = true
                },
                indent = {
                    enable = true
                },
            },
        },
        {
            'numToStr/Comment.nvim',
            opts = {
                pre_hook = function()
                    return vim.bo.commentstring
                end,
            },
        },
}, {})

How? I am really confused. The lazy documentation specifies to choose opts over config: https://lazy.folke.io/spec#spec-setup

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions