Comments (7)
Why not let the user decide whether
ft_table
orcommentstring
gets priority (ideally configurable per-filetype?). Lettingcommentstring
have priority would eliminate the need for any integration code at all fornvim-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.
Also, please provide the actual issue that you are facing with the plugin.
from comment.nvim.
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.
Because
nvim-ts-context-commentstring
updatescommentstring
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
overft.lua
for tsx/jsx, then no pre-hook integration would be needed-- just installingnvim-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.
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.
I'm pointing out that
nvim-ts-context-commentstring
already updatescommentstring
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.
OK, thx for engaging.
from comment.nvim.
Related Issues (20)
- How to support context filetype?
- Uses `//` as commentstring in html HOT 4
- NOT A BUG/ISSUE [a gen qs] HOT 2
- How to just do comment or uncomment?
- Willing to accept a PR if I add a setup option "default commentstring"? HOT 2
- comment config working on arch but not on linux (arch) HOT 1
- Retain visual mode after commenting HOT 1
- [BUG] When I try to comment linewise in visual mode, unrelated or extra code gets commented HOT 5
- Adding a FOSS license HOT 2
- Not working for typescript react HOT 1
- BUG: fails silently in absence of LuaJIT HOT 1
- ft.set() not working for blade files defaults to html comments HOT 1
- Support inline commenting of wrapped shell commands
- Toggler remap with <leader>/ not working HOT 2
- Feat request: Toggle code block by pressing a key in a single line (context aware)
- Feature request: Option to start comment before indentation
- Is this still needed with Neovim 0.10? HOT 3
- Comments inside Twig files are always using HTML syntax
- 注释代码响应很慢 HOT 1
- Support for JSON5 filetype
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comment.nvim.