在Visual Studio中,如何将默认的XML摘要注释片段从三行更改为一行?
目前,当我输入时,它会提供以下代码段///:
/// <summary>
///
/// </summary>
Run Code Online (Sandbox Code Playgroud)
我想要这个更短的片段:
///<summary></summary>
Run Code Online (Sandbox Code Playgroud)
我的摘要通常很简短,额外的2行是不必要的.
是否有此配置设置或某些可自定义的代码/自定义插件来解决此问题.
我有一些REST服务(使用和生成application/json),我用它@TypeHint来生成文档.
现在我有这样的事情:
import javax.ws.rs.core.Response;
...
@Path("/path")
public class MyClass {
@GET
@TypeHint(MyResponse.class)
public Response getIt() {
MyResponse resp = ... ;
return MyBuilder.build(resp);
}
}
Run Code Online (Sandbox Code Playgroud)
但是MyResponse是一个包装List<MyType>.
我的build方法MyResponse看起来像这样:
public static Response build(Serializable payload) {
return Response.ok(msr).header(...).build();
}
Run Code Online (Sandbox Code Playgroud)
我想直接使用List<MyType>而不是MyResponse.TypeHint在以下代码中使用哪种方法最好?
@GET
@TypeHint(/* TODO */)
public Response getIt() {
List<MyType> myList = ... ;
return MyBuilder.build(myList);
}
Run Code Online (Sandbox Code Playgroud)
我在考虑以下选项:
@TypeHint(List.class)@TypeHint(MyType.class)@TypeHint(List<MyType>.class) - >遗憾的是,由于Java类型擦除,这不起作用.题:
3号有没有有效的替代方案? …
Neo4j的浏览器允许使用GRASS语言(GRaph样式表)中类似CSS的样式文件对其显示的图形进行样式设置.但是,我还没能找到这种语言的语法.有没有,如果有,哪里可以找到?
如何在 XML 代码文档中引用类型参数?例如,这段代码
/// <summary>
/// An interface.
/// </summary>
/// <typeparam name="TInterface">Type paramter.</typeparam>
public interface IFace<TInterface>
{
/// <summary>
/// Does the thing.
/// </summary>
/// <typeparam name="TMethod">Different from <see cref="TInterface"/>.</typeparam>
/// <returns>An integer.</returns>
int SomeMethod<TMethod>();
}
Run Code Online (Sandbox Code Playgroud)
给出警告typeparam name="TMethod":
XML 注释具有引用类型参数的 cref 属性“TInterface”。
这个问题询问有关引用泛型类型,但我想引用类型参数。
当我使用 REPL 时,我有时需要查找函数的功能,例如splice. 我通常会访问文档网站。但我并不总是有互联网,如果我可以直接在 REPL 中编写help("splice")或某些内容(例如splice?)并查看结果,那就太好了。
然后我认为p6docRakudo Star 附带的可以使用,因为p6doc Array.splice在命令行上提供了文档。然后我在 REPL 中这样做:
> run <p6doc Array.splice>\n\nProc.new(in => IO::Pipe, out => IO::Pipe, err => IO::Pipe, exitcode => 1,\n signal => 0, pid => Nil, command => ("p6doc", "Array.splice"))\nRun Code Online (Sandbox Code Playgroud)\n:out但它有 exitcode 1。当我使用和捕获输出时:err,两者都是空字符串,但我不知道为什么。
有没有办法让 REPL 中的这种帮助功能与“run p6doc”或其他东西一起工作?
\n我使用 Windows10
\nWelcome to \xe2\x84\xa2 v2021.07.\nImplementing the \xe2\x84\xa2 programming language v6.d.\nBuilt on MoarVM version 2021.07.\nRun Code Online (Sandbox Code Playgroud)\n introspection code-documentation rakudo read-eval-print-loop raku
如何强制Doxygen显示完整的包含路径?
我的意思是:
我在以下目录结构中foo::bar::bee定义了一个类bee.hpp:
foo
foo/bar
foo/bar/bee.hpp
Run Code Online (Sandbox Code Playgroud)
Doxygen,当它文档foo::bar::bee类告诉你需要包含<bee.hpp>,但对于我需要的软件<foo/bar/bee.hpp>
我怎么能让Doxygen这样做?有没有选项提供"包括标志",如"-I"所以doxygen会知道基地在哪里?
笔记:
FULL_PATH_NAMES 已设置为默认值 YES谢谢.
回答
组:
STRIP_FROM_INC_PATH = relative/path/to/include/directory
Run Code Online (Sandbox Code Playgroud) 我不知道在哪里寻求有关Java API文档和Java代码的澄清和确认,所以我在这里做.
在API文档中FileChannel,我发现在一个以上的地方提交文件position和文件的一个一个错误size.
这只是一个例子.transferFrom(...)州的API文件:
"如果给定位置大于文件的当前大小,则不传输任何字节."
我确认OpenJDK代码也包含此代码...
public long transferFrom(ReadableByteChannel src, long position, long count)
throws IOException
{
// ...
if (position > size())
return 0;
// ...
}
Run Code Online (Sandbox Code Playgroud)
...在FileChannelImpl.java与文档一致的文件中.
现在,虽然上面的代码片段和API文档看起来相互一致,但我觉得"上面应该'大于或等于'而不仅仅是'大于',因为position它是一个基于0的文件数据索引,阅读时position == size()将没有数据返回给来电者!(position == size() - 1至少1个字节 - 文件的最后一个字节 - 可以返回给调用者.)
以下是同一API文档页面中的其他类似实例:
position(...):"将位置设置为大于文件当前大小的值是合法的,但不会更改文件的大小." (应该是'大于或等于'.)
transferTo(...):"如果给定位置大于文件的当前大小,则不传输任何字节." (应该是'大于或等于'.)
read(...):"如果给定位置 …
是否有正确的方法来记录在另一个维度内的数组中的值/对象?
通常,数组将按如下方式处理:
/** @var ClassName[] $Array */
$Array = array( $InstanceOfClassName,.. )
Run Code Online (Sandbox Code Playgroud)
但是我需要这样的东西:
/** @var ClassName[][] $Array */
$Array = array( 0 => array( $InstanceOfClassName,.. ) )
Run Code Online (Sandbox Code Playgroud)
这显然不起作用,那么正确的PHPDoc表示法是什么?
我正在寻找类似 GhostDoc for VS Code (C#) 的东西,但没有成功。有谁知道什么吗?
我只找到了一个“旧的”类似 VS 的扩展,它使 XML 注释在您键入“///”时可用,但这不是我正在寻找的。
Perl 6的具有实用的功能,允许人们得到任何波德声明符块附加到一个子程序(或类,角色等),使用该WHY方法:
#|(Some enlightening words about myfunc.)
sub myfunc (Int $i) { say "You provided an integer: $i"; };
#=(Some more words about myfunc.)
say &myfunc.WHY;
Run Code Online (Sandbox Code Playgroud)
这显示:
Some enlightening words about myfunc.
Some more words about myfunc.
Run Code Online (Sandbox Code Playgroud)
不幸的是,当一个子程序有多个候选者时,不能只调用.WHY子程序名:
#|(myfunc accepts an integer.)
multi myfunc (Int $i) { say "You provided an integer $i"; };
#|(myfunc accepts a string.)
multi myfunc (Str $s) { say "You provided a string $s"; };
say &myfunc.WHY;
Run Code Online (Sandbox Code Playgroud)
结果: …