You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Okay so I found out some of the issues and why they happen (I think). It seems to be the case like you say that treesitter is interpreting it as another language, but I could only reproduce this if the newline is between the starting tag and the first line inside the tags.
With the newline there, treesitter interprets that as filetype vue, and I don't think there is much we can do about that. One thing I think we can do is calculate the commentstring based on where the cursor is when doing the motion. Right now it looks like the cursor jumps to the start of the motion, and then when finding the language where the cursor is currently, the language is returned as vue. After this the cursor returns to where it was (probably has something to do with the sticky option). If one is holding the cursor over the newline and uncomment, there isn't much we can do (to my knowledge) since treesitter interprets this as vue.
However there is also a slight issue with empty lines if the commentstring surrounds the string (commentstrings like /* %s */ for example). If there is a newline inside the tag when doing gcit for example, the newline will only get /* inserted on the line. This will mess with the logic of checking if a line is commented or not, so therefore it will try to comment this again instead of uncommenting.
Note that this will not be an issue with commentstrings like // %s, and also not for those who chose to ignore the newlines in lua pattern option in the setup function. I also don't think this is related to this PR, so this could probably be fixed in another PR.
If we add the rhs of the commentstring (*/) to the newline, after /* the problem is fixed. Like this
The text was updated successfully, but these errors were encountered:
numToStr
changed the title
Okay so I found out some of the issues and why they happen (I think). It seems to be the case like you say that treesitter is interpreting it as another language, but I could only reproduce this if the newline is between the starting tag and the first line inside the tags.
Invalid css comments on empty lines
Nov 19, 2021
Okay so I found out some of the issues and why they happen (I think). It seems to be the case like you say that treesitter is interpreting it as another language, but I could only reproduce this if the newline is between the starting tag and the first line inside the tags.
With the newline there, treesitter interprets that as filetype vue, and I don't think there is much we can do about that. One thing I think we can do is calculate the commentstring based on where the cursor is when doing the motion. Right now it looks like the cursor jumps to the start of the motion, and then when finding the language where the cursor is currently, the language is returned as vue. After this the cursor returns to where it was (probably has something to do with the sticky option). If one is holding the cursor over the newline and uncomment, there isn't much we can do (to my knowledge) since treesitter interprets this as vue.
However there is also a slight issue with empty lines if the commentstring surrounds the string (commentstrings like
/* %s */
for example). If there is a newline inside the tag when doinggcit
for example, the newline will only get/*
inserted on the line. This will mess with the logic of checking if a line is commented or not, so therefore it will try to comment this again instead of uncommenting.Note that this will not be an issue with commentstrings like
// %s
, and also not for those who chose to ignore the newlines in lua pattern option in the setup function. I also don't think this is related to this PR, so this could probably be fixed in another PR.If we add the rhs of the commentstring (
*/
) to the newline, after/*
the problem is fixed. Like thisOriginally posted by @seblj in #62 (comment)
The text was updated successfully, but these errors were encountered: