JoosepAlviste / nvim-ts-context-commentstring

Neovim treesitter plugin for setting the commentstring based on the cursor location in a file.
MIT License
1.13k stars 34 forks source link

Does not seems to work on html files like shown in the doc #114

Open Curs3W4ll opened 2 months ago

Curs3W4ll commented 2 months ago

Minimal reproducible full config

-- Install lazy.nvim automatically
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system {
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  }
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup {
        "JoosepAlviste/nvim-ts-context-commentstring",
  {
    'nvim-treesitter/nvim-treesitter',
    build = ':TSUpdate',
    config = function()
      require('nvim-treesitter.configs').setup {
        ensure_installed = { 'vim', 'lua', 'html' },
      }
    end,
  },
}

Description

I just tried to use this plugin, but I cannot make it work as expected.

I tried with .vue files, then with the example in the doc with the .html file with the <style> tag.

Whenever I try to get the comment string using require("ts_context_commentstring").calculate_commentstring(), it will always giving me the base HTML one (<!-- %s -->)

https://github.com/JoosepAlviste/nvim-ts-context-commentstring/assets/72013831/15a00081-df78-42c2-a554-4c31d0589100

I don't know if I missed something? Did I do something wrong?

Steps to reproduce

Expected behavior

The plugin should correctly calculate the commentstring to use according to the current cursor position

Actual behavior

The plugin always returns the base HTML commenstring, no matter if being in a <style> tag, or <script> tag

Additional context

OS: MacOS Sonoma 14.5 (23F79) Nvim version: NVIM v0.9.4 (also tested with NVIM v0.11.0-dev-164+g3a1515bfe)