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

BREAKING CHANGES #82

Open JoosepAlviste opened 9 months ago

JoosepAlviste commented 9 months ago

The comments of this issue will include all breaking changes together with migration guides.

Please open a separate issue if there are any issues following the migration guides. I'd like to keep this thread clean so that it would be easy to find information for everyone.

JoosepAlviste commented 9 months ago

The minimum Neovim version for this plugin is now version 0.9: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/commit/34ff1fa0abd0f5d0a595025a3c6808630e737fcf

Migration guide

Update to Neovim version 0.9

JoosepAlviste commented 9 months ago

Usage as a nvim-treesitter module has been deprecated: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/pull/80. Configuration as a nvim-treesitter module configuration will still work, but you should see a message notifying you of the deprecation. It will be removed some time in the future (unsure when, probably in a couple months).

The plugin is set up automatically now.

This also increases the minimal Neovim version to 0.9.4.

Migration guide

Upgrade your Neovim version to at least 0.9.4.

If you're using the default configuration, then just delete the nvim-treesitter module configuration:

Before:

require('nvim-treesitter.configs').setup {
  context_commentstring = {
    enable = true,
  },
}

After:

require('nvim-treesitter.configs').setup {}
-- nvim-ts-context-commentstring is set up automatically

If you're using any custom configuration, then use require('ts_context_commentstring').setup:

Before:

require('nvim-treesitter.configs').setup {
  context_commentstring = {
    enable = true,
    enable_autocmd = false,
    -- or "config" if you're still using the old configuration key
    languages = {
      typescript = '// %s',
    },
  },
}

After:

require('ts_context_commentstring').setup {
  enable_autocmd = false,
  languages = {
    typescript = '// %s',
  },
}
marcelarie commented 9 months ago

This does not work for me after the migration, I get // comments in jsx.

My config looks like this:

require('nvim-treesitter.configs').setup {}
JoosepAlviste commented 9 months ago

Hey @marcelarie! Could you create an issue with a minimal config? Also, what version of Neovim are you using (0.9.4+ is required)?

marcelarie commented 9 months ago

@JoosepAlviste hey sorry for the late reply, I will check it soon and try to find the issue. Thanks!

JoosepAlviste commented 1 month ago

The c language single-line commentstring configuration has changed to match the Vim default of /* %s */ (https://github.com/JoosepAlviste/nvim-ts-context-commentstring/pull/85). Here's how to get the same behavior as before:

require('ts_context_commentstring').setup {
  languages = {
    c = { __default = '// %s', __multiline = '/* %s */' },
  },
}