rabbitco
rabbitco

Reputation: 2850

Sublime Text 3/4: copy/paste all text excluding comments

I use Sublime Text (Build 4189) writing code and JSON for Microsoft Power Automate.

The work is imported to Power Automate by copy/pasting it. It must be free of any comments. However, it is too cumbersome to exclude these comments by a manual selection process. I need a solution where I Select All, Copy it and then somehow are able to paste it without the comments.


Example:

{
// Comments explaining JSON

   "id": "",
   "receivedDateTime": "",
   "hasAttachments": false,
   "internetMessageId": "",
   "subject": ""
}  

should therefore be copy/pasted as:

{
   "id": "",
   "receivedDateTime": "",
   "hasAttachments": false,
   "internetMessageId": "",
   "subject": ""
}  

--> Is there a (simple) way to copy/paste all code from a Sublime Text file excluding any comments?

Upvotes: 0

Views: 39

Answers (1)

rabbitco
rabbitco

Reputation: 2850

Not a perfect solution, but definitely acceptable:

Install package Remove​Comments. Then remove all comments via commands palette, copy/paste and then undo remove all comments.

Upvotes: 0

Related Questions