为什么python不使用C/C++/Java使用的传统风格的注释:
/**
* Comment lines
* More comment lines
*/
// line comments
// line comments
//
Run Code Online (Sandbox Code Playgroud)
是否有特定原因或者它是否随意?
我可以使用什么字符将评论放在Exuberant Ctags .ctags文件中?
我想添加注释和解释,也许是禁用一些正则表达式.
但我找不到ctags-exuberant接受的评论字符!
我一直收到警告:
ctags: Warning: Ignoring non-option in /home/joey/.ctags
Run Code Online (Sandbox Code Playgroud)
这比错误更好,但仍然有点烦人.
我试过# // /* ... */并;作为评论,但是ctags试图解析它们!
这是一个示例文件,其中包含一些ctags会抱怨的注释:
# Add some more rules for Javascript
--langmap=javascript:+.jpp
--regex-javascript=/^[ \t]*var ([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\1/v,variable/
--regex-javascript=/^[ \t]*this\.([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]*=.*$/\1/e,export/
--regex-javascript=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*):.*$/\1/p,property/
--regex-javascript=/^\<function\>[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)/\1/f,function/
# Define tags for the Coffeescript language
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^class @?([a-zA-Z_$][0-9a-zA-Z_$]*)( extends [a-zA-Z_$][0-9a-zA-Z_$]*)?$/\1/c,class/
--regex-coffee=/^[ \t]*(@|this\.)([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\2/e,export/
--regex-coffee=/^[ \t]*@?([a-zA-Z_$][0-9a-zA-Z_$]*):.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]+=.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]+=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@?([a-zA-Z_$][0-9a-zA-Z_$]*):.*$/\1/p,property/
Run Code Online (Sandbox Code Playgroud) 我已经习惯了更受欢迎的'胡须'样式模板,我可以在其中为同事添加评论:
{# The following code looks a bit odd, but here's why... #}
这些注释显然没有出现在输出中 - 因此用户看不到它们.我如何在Angular中做类似的事情?
有没有办法评论多行...已经有一些评论?
即
<html>
<!-- Multi-line comment begin
<head>
<!-- This script does abcxyz -->
<script>...</script>
</head>
<body>
Hello world!
</body>
Multi-line comment end -->
</html>
Run Code Online (Sandbox Code Playgroud)
似乎即使是SO的语法hilighting也不会接受这个......
这已成为我的一个宠儿.我写了一个课,并实施Serializible.然后eclipse警告我,我没有serialVersionUID,所以我选择" 添加生成的serialVersionUID "或" 添加默认的serialVersionUID ",我最终得到这样的东西:
/**
*
*/
private static final long serialVersionUID = 4049849541314027178L;
Run Code Online (Sandbox Code Playgroud)
大多数时候我不想添加评论,所以我必须去删除评论.我宁愿默认是没有评论,但我已经查看了偏好中的代码模板,并没有想出如何更改它.我只是希望它看起来像这样:
private static final long serialVersionUID = 4049849541314027178L;
Run Code Online (Sandbox Code Playgroud) 我试图找到一种方法来对一批代码使用多行注释,但是它一直把它中的一些语法误认为是]]并且我想它要结束那里,我不这样做!
--[[
for k,v in pairs(t) do
local d = fullToShort[k]
local col = xColours[v[1]] -- It stops here!
cecho(string.format(("<%s>%s ", col, d))
end
--]]
Run Code Online (Sandbox Code Playgroud)
我以为我在某个地方读过可以使用不同的组合来避免这些错误,比如 - [= [或诸如此类的......有人可以帮忙吗?
这困扰了我一段时间,也许我错过了一些东西.
以下引用了注释属性(expected>)的错误,但是我不能做这样的事情吗?
<Label x:Name="Gaga"
FontSize="20"
<!--
Content="{Binding SomethingThatIsEmptyAtDesignTime"}
-->
Content="LookAtMe!"
/>
Run Code Online (Sandbox Code Playgroud) 通常在html中编写视图模板时,我习惯添加一些有用的注释会导致测试时花费大量时间.
考虑这段代码......
<!-- Here starts the sidebar -->
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane -->
<div id="main-contents">
...
</div>
<!-- Here starts the footer -->
<div id="footer">
...
</div>
Run Code Online (Sandbox Code Playgroud)
现在,如果我必须隐藏视图模板的某些部分,在php的情况下,我只需选择所需的代码并放置单行注释(大多数时候使用快捷键).
但是,在html代码中,只有块注释有效,我最终删除所有结束注释标记( - >),直到我希望注释发生的位置 - 这样的事情......
<!-- Here starts the sidebar
<div id="sidebar">
....
</div>
<!-- Here starts the main contents pane
<div id="main-contents">
...
</div>
<!-- Here starts the footer
<div id="footer">
...
</div>-->
Run Code Online (Sandbox Code Playgroud)
然后,当我完成测试时,我必须经历将那些结束标签放回去的痛苦.
在HTML中是否有更好的和省时的块注释方式?
是否/* (non-javadoc)有一个含义,超越指出,以源代码的读者,一个注释块是不是故意Javadoc注释?最近我看到很多代码看起来像这样:
/*
* (non-javadoc)
*
* This method converts widgets to gizmos
*/
public Foo bar() {
...
Run Code Online (Sandbox Code Playgroud)
这是某种既定的惯例吗?如果是这样,它是什么意思(超出明显的字面含义)以及何时使用?
我正在尝试第一次学习SVG,但代码似乎与我的块注释有问题.我正在使用:
/* This is my
* block comment
*/
Run Code Online (Sandbox Code Playgroud)
当我运行我的代码时,我收到以下错误:
'return' statement outside of function
line: 116, column: 4
Run Code Online (Sandbox Code Playgroud)
这恰好发生在我的块评论之前.