rioj7 / remove-comments

Visual Studio Code extension to remove comments from files.
11 stars 4 forks source link

Single line strings must end at line ending - report error if fail #17

Open Alon122 opened 3 weeks ago

Alon122 commented 3 weeks ago

The extantion is not working anymore

rioj7 commented 3 weeks ago

@Alon122 have you tried v1.9.0, I made an update and run the tests.

Can you show me the file, as small as possible, you want to remove the comments of. Just fill in some dummy texts

The changes in v1.10.0 should only impact SASS, Jade, Pug files

Alon122 commented 3 weeks ago

@Alon122 have you tried v1.9.0, I made an update and run the tests.

Can you show me the file, as small as possible, you want to remove the comments of. Just fill in some dummy texts

Its working now, i don't know what happened

rioj7 commented 3 weeks ago

@Alon122 Just show an example next time the extension gives wrong results

Alon122 commented 3 weeks ago

@rioj7 Hey man, its removing links now Desktop 2024 11 03 - 12 42 24 04

rioj7 commented 3 weeks ago

@Alon122 You have a very large file. The extension does not remove true comments like on line 1588

// Adjust width on load

That can only happen if somewhere before line 1588 you don't have closed a string properly with " as separator. The extension thinks it is still parsing a string.

VSC syntax highlighting is not as strict as the extension regarding string termination on the same line for certain separators.

Maybe I should add logic that certain strings must end at the line ending.

rioj7 commented 3 weeks ago

@Alon122 If you select function fetchSkinIcon and then execute Remove All Comments does it also remove the link inside the string on line 1604

rioj7 commented 3 weeks ago

@Alon122 If I try to recreate an unterminated string literal the Typescript Language server will signal that. And because you have no errors reported that is not the case.

Another possibility is that you have a Regular Expression literal /some_regex/ that contains an odd number of string delimiter characters like ".

rioj7 commented 1 week ago

@Alon122 Have you found the line that is putting the parser in an incorrect state?

Alon122 commented 1 week ago

There isn't one, idk man

rioj7 commented 1 week ago

@Alon122 There has to be because line 1588 should be modified, please try with sections started from the top and look if some comments are removed that are trivial. Use a binary search method.