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

Support for HTMLDjango with Non-Nested Language Option #92

Open Brick85 opened 8 months ago

Brick85 commented 8 months ago

This pull request introduces support for comments in the HTMLDjango template language. While the detection of nested languages and formatting comments accordingly is generally advantageous, there are cases where it may be counterproductive, especially in file types like HTMLDjango templates.

In HTMLDjango templates, it is preferable to utilize Django template comments not only within HTML but also in JavaScript and CSS. These comments effectively exclude code from rendering and prove beneficial. The proposed change becomes essential for commenting on template control statements, addressing a limitation in the existing functionality.

Please review and consider merging this pull request to enhance the plugin's compatibility with HTMLDjango templates.

andresmrm commented 3 months ago

Hi! @JoosepAlviste, any reason for not accepting this MR? I've just tested it and it seems to work. It's very important for Django templates.

JoosepAlviste commented 3 months ago

Hey! To be honest, I have kind of forgotten about this PR 😅 Thanks for the ping!

I can definitely see that we should handle the Django templates correctly. At first glance, it seemed like having a not_nested_languages solution was a bit too specific (only required for 1 filetype), so I was hoping that I could come up with a better approach.

If I understand it correctly, then we want to absolutely ignore any html nodes inside htmldjango files? So, we would always use the htmldjango commenting style ({# %s #}) in the whole file. It would be nice, though, if <script> tags still had the correct commentstring.

andresmrm commented 3 months ago

To be honest, I have kind of forgotten about this PR 😅 Thanks for the ping!

It happens. :stuck_out_tongue_closed_eyes:

It would be nice, though, if Githubissues.

  • Githubissues is a development platform for aggregating issues.