Fix issue #311 (Ambiguous newlines in --doc output)
This commit is contained in:
parent
78ba8a69bf
commit
9b4c862081
|
@ -156,7 +156,7 @@ When run with the --doc or -d option, DCD will attempt to display documentation
|
|||
comments associated with the symbol at the cursor position. In the case of
|
||||
functions there can be more than one documentation comment associated with a
|
||||
symbol. One doc comment will be printed per line. Newlines within the doc
|
||||
comments will be replaced with "\n".
|
||||
comments will be replaced with "\n", and backslashes escaped as "\\".
|
||||
#### Example output
|
||||
An example doc comment\nParams: a = first param\n Returns: nothing
|
||||
An example doc comment\nParams: a = first param\n b = second param\n Returns: nothing
|
||||
|
|
|
@ -88,6 +88,10 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
|
|||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
outputRange.put('\\');
|
||||
outputRange.put('\\');
|
||||
break;
|
||||
case '\n':
|
||||
outputRange.put('\\');
|
||||
outputRange.put('n');
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
This is not a newline: \\n But this is:\nThis is not a newline either: $(D '\\n')
|
|
@ -28,3 +28,12 @@ unittest
|
|||
g;
|
||||
cool;
|
||||
}
|
||||
|
||||
/** This is not a newline: \n But this is: */
|
||||
/** This is not a newline either: $(D '\n') */
|
||||
int f;
|
||||
|
||||
unittest
|
||||
{
|
||||
f;
|
||||
}
|
||||
|
|
|
@ -21,3 +21,6 @@ diff actual6.txt expected6.txt
|
|||
|
||||
../../bin/dcd-client $1 file.d -c313 -d> actual7.txt
|
||||
diff actual7.txt expected7.txt
|
||||
|
||||
../../bin/dcd-client $1 file.d -c432 -d> actual8.txt
|
||||
diff actual8.txt expected8.txt
|
||||
|
|
Loading…
Reference in New Issue