Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration for kommentary #10

Closed
ya2s opened this issue Jun 2, 2021 · 3 comments
Closed

integration for kommentary #10

ya2s opened this issue Jun 2, 2021 · 3 comments

Comments

@ya2s
Copy link

ya2s commented Jun 2, 2021

Let me know if you'd like a similar integration for another commenting plugin.

https://github.com/b3nj5m1n/kommentary

@gegoune
Copy link

gegoune commented Jun 2, 2021

@yamatsum b3nj5m1n/kommentary#43

No need to do anything on this plugin's side.

@ya2s
Copy link
Author

ya2s commented Jun 2, 2021

Thanks!
If I comment out twice in tsx, it will behave strangely.

CleanShot 2021-06-03 at 00 59 55@2x

require("kommentary.config").configure_language("typescriptreact", {
    hook_function = function()
       pre_comment_hook = require('ts_context_commentstring.internal').update_commentstring()
    end,
    prefer_single_line_comments = true,
})

@JoosepAlviste
Copy link
Owner

The kommentary integration looks great! I'll add a note about it in the README.

@yamatsum About commenting twice in JSX, that seems to be a problem in general, not directly related to kommentary.

The issue is that if you comment the first line (only the first line) in any JSX block, then there will be a syntax error. For example, this is not valid JS/JSX:

const App = () => (
  {/* <div> */}
    <p>Hello world</p>
  </div>
)

Now, treesitter thinks that the first line of JSX with the comment is an object.

I created an issue for this: #11 but I don't think that it's super high priority for now. I probably won't be dealing with it any time soon.


Toggling comments of other bits of JSX seems to work fine though, so I hope that it's OK at the moment. Hopefully it won't be necessary to comment the first line of JSX very often 😃

@ya2s ya2s closed this as completed Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants