在我的sass代码中,我有内联注释,我希望在崇高的文本中删除它们.是否可以永久删除所有评论内容?
@function emCalc($values) {
$emValues: '';
$max: length($values); //Get the total number of parameters passed
@for $i from 1 through $max {
$value: (nth($values, $i)); //Take the individual parameter
$value: $value / ($value * 0 + 1); //Doing this gets you one unit (1px)
$value: $value / $em-base * 1em; //Divide the px value by emBase and return the value as em
$emValues: #{$emValues + $value}; //Append to array
@if $i < $max {
$emValues: #{$emValues + " "}; //Adding space between parameters (except last), if there are multiple parameters
}
}
@return $emValues; //Call emCalc like so emCalc(10, 20, 30, 40) it should return margin: 0.625em 1.25em 1.875em 2.5em
}
Run Code Online (Sandbox Code Playgroud)
Nic*_*lin 33
你需要仔细检查这个(备份方便!),但是下面的正则表达式应该在"替换"窗口中工作,启用正则表达式(*图标):
*选中图标来启用正则表达式匹配在"查找内容"中输入以下内容?框
\/\/.*
Run Code Online (Sandbox Code Playgroud)将"替换为"框保留为空以删除找到的文本.
正如@ollie所说,这也会删除所有前缀的网址//.以下(轻度测试)正则表达式应该用于更好地定位评论:(^\/\/.*)|(\s+\/\/.*)
单行和多行注释的解决方案 (^\/\/.*)|(\s+\/\/.*)|((\/\*)(.|\n)+?(\*\/))
Max*_*ant 17
如果您没有其他可能性,您可以选择每一个//(如果我的记忆正确,则先选择,//然后CtrlD留下评论).
然后按ShiftEnd,用a //和Del!选择每一行.:)
(可能有一个插件,但这是我认为最简单的方法.这表明你所有的都//指的是评论的开头,当然)
这里的答案似乎都没有利用语法突出显示已经确定所有注释的位置这一事实 - 只需在 Python 控制台(查看菜单 -> 显示控制台)中执行此操作即可选择所有注释:
view.sel().clear(); view.sel().add_all(view.find_by_selector('comment'))
Run Code Online (Sandbox Code Playgroud)
(Enter键入/粘贴后按执行它)然后按Delete删除所有选择并Esc返回单选模式
其他答案都没有涵盖所有情况(多行注释、单行注释、双斜杠注释和斜杠星号/星号斜杠注释)。
为了匹配所有可能的情况(不匹配 URL),请使用以下命令:
(^[\s]*?\/\/.*)|(/\*[\s\S]+?\*/)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20055 次 |
| 最近记录: |