日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

vscode删除文件夹,VSCode:删除文件中的所有注释

發布時間:2025/3/12 编程问答 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vscode删除文件夹,VSCode:删除文件中的所有注释 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Is there an easy way to delete all comments from an open file in VSCode? Preferably both line and block comments.

Most interested in Java, but also Python and R.

解決方案

Easy way:

Open extensions (ctrl-shift-x)

type in remove comments in the search box.

Install the top pick and read instructions.

Hard way (I guess)

search replace(ctrl-h)

toggle regex on (alt-r).

A simple //.* will match all single line comments (and more ;D). #.* could be used to match python comments. And /\*[\s\S\n]*\*/ matches block comments. And you can combine them as well: //.*|/\*[\s\S\n]*\*/ (| in regex means "or", . means any character, * means "0 or more" and shows how many characters to match, so therefor .* means all characters until the end of the line)

Of course with caveats, such as urls (https://...) has double slashes and will match that first rule, and god knows where there are # in code that will match that python-rule. So some reading/adjusting has to be done!

Once you start fiddling with your regexes it can take a lifetime to get them perfect, so be careful. I'd probably go the easy route if you haven't touched regexes before! But knowing some simple regex by heart will do you good, since it's usable almost everywhere.

總結

以上是生活随笔為你收集整理的vscode删除文件夹,VSCode:删除文件中的所有注释的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。