Giter Site home page Giter Site logo

Comments (7)

numToStr avatar numToStr commented on May 19, 2024

Why not let the user decide whether ft_table or commentstring gets priority (ideally configurable per-filetype?). Letting commentstring have priority would eliminate the need for any integration code at all for nvim-ts-context-commentstring.

I think you are confused regarding the use of nvim-ts-context-commentstring. How letting the user set priority would remove the need for nvim-ts-context-commentstring integration?

from comment.nvim.

numToStr avatar numToStr commented on May 19, 2024

Also, please provide the actual issue that you are facing with the plugin.

from comment.nvim.

smackesey avatar smackesey commented on May 19, 2024

I think you are confused regarding the use of nvim-ts-context-commentstring. How letting the user set priority would remove the need for nvim-ts-context-commentstring integration?

Because nvim-ts-context-commentstring updates commentstring for you during editing. So, if the user were able to configure the plugin to prioritize commentstring over ft.lua for tsx/jsx, then no pre-hook integration would be needed-- just installing nvim-ts-context-commentstring would be enough. When commenting, Comment.nvim would just read the commentstring already set by nvim-ts-context-commentstring.

To illustrate, this is my current (working) pre-hook configuration. All it does is return commentstring:

pre_hook = function(ctx)
  if vim.bo.filetype == 'typescriptreact' then
    return vim.o.commentstring
  end
end

Also, please provide the actual issue that you are facing with the plugin.

Sorry I was unclear, this is a feature request.

from comment.nvim.

numToStr avatar numToStr commented on May 19, 2024

Because nvim-ts-context-commentstring updates commentstring for you during editing.

Yes and No. The integration that is showcased in the readme doesn't update the commentstring. It just returns that string so that it can be used for comment/uncomment.

So, if the user were able to configure the plugin to prioritize commentstring over ft.lua for tsx/jsx, then no pre-hook integration would be needed-- just installing nvim-ts-context-commentstring would be enough.

You would still need to call something to update commentstring (which I don't recommend), hence pre_hook


I have already thought of this before making this plugin and IMO updating commentstring every time is just not worth. Why not just use that string instead of updating a editor's setting? If you get my point, then your request for "priority" will look redundant :)

from comment.nvim.

smackesey avatar smackesey commented on May 19, 2024

We're miscommunicating-- I'm not suggesting that Comment.nvim should update commentstring. I'm pointing out that nvim-ts-context-commentstring already updates commentstring, indepedent of anything Comment.nvim does.

You would still need to call something to update commentstring (which I don't recommend), hence pre_hook

You do not-- that's why the pre_hook I posted (much shorter than the recommended integration) already works. It does not update commentstring, because nvim-ts-context-commentstring does it automatically.

from comment.nvim.

numToStr avatar numToStr commented on May 19, 2024

I'm pointing out that nvim-ts-context-commentstring already updates commentstring

This is what I don't recommend because you have an option to use the calculated commentstring which I showed in the readme.

I understand your point but it's the design choice i made with pre_hook and ft_table which I don't intend to change or provide any kind of setting to override that.


IMO the integration code b/w both the plugin is way too verbose. And I believe that can be improved (you can talk to it's author). I am also thinking of making a Comment.nvim only jsx integration as a separate plugin but I am lacking motivation XD

from comment.nvim.

smackesey avatar smackesey commented on May 19, 2024

OK, thx for engaging.

from comment.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.