plibither8 / vscode-remove-comments

🚫 VS Code extension to remove all comments from your code at once — 60+ languages supported
https://marketplace.visualstudio.com/items?itemName=plibither8.remove-comments
MIT License
36 stars 13 forks source link

Removes non-commented code. #28

Closed jub0t closed 2 years ago

jub0t commented 2 years ago

So I removed all comments from my file and the extension remove everything after the // in my string.

Before

app.listen(7000, () => {
  console.log("Server is running at http://127.0.0.1:7000");
});

After

app.listen(7000, () => {
  console.log("Server is running at http:
});
cbserra commented 2 years ago

Yes, same here. Executing Remove All Comments in a CSS file truncated my @import of a Google Font:

@import url("https://fonts.googleapis.com/css2?...");

=>

@import url("https:

Also, CSS doesn't support // comments, only the multi-line variant (/* ... */)

I guess one solution to try, is to not remove content following a comment delimiter inside quotations?

rioj7 commented 2 years ago

@jareer12 @cbserra

It looks like this is no longer maintained and it can only handle 1 type of line and block comment.

There is an alternative extensions that removes comments and it should detect literal strings and skip there content: Remove Comments