I want to describe a half-opened period [start, end) in a comment where both, start and end refer to a parameter of a method:
/// Gets all items within period [[start],[end])
Which is displayed by intelij like this:
Using \ as escape character has the same problem:
What is the escape character in dart comments? The official documentation seems not to state how to escape the [.
I don't know the escape character you're talking about, but you can add an extra pair of brackets after the single bracket you want to show:
/// Gets all items within period [[][start],[end])
It will look like this:
and when you hover your mouse over the method:
Normally square brackets denote identifiers that dartdoc should automatically generate links for. If you want literal square brackets in the generated documentation, you can escape them with a backslash:
/// Gets all items within period \[[start],[end])
For example, the following comment:
/// A fraction in the range \[0, 1\] that represents what proportion of the
/// widget is visible (assuming rectangular bounding boxes).
Generates:
https://pub.dev/documentation/visibility_detector/latest/visibility_detector/VisibilityInfo/visibleFraction.html
I also need to comment brackets as part of a range.
I ended up escaping the whole line with 3 backticks (```)
The disadvantage is I cannot refer to any parameters/methods in that (code) comment, but on the bright side the comment is still very readable in the code.
If you need to refer the parameters, an extra line might be added to do this
E.g.:
/// ```
/// Gets all items within period [start,end]
/// ```
///
/// The referred values are [start], [end]
Related
In a snake_cased language, I would want to navigate variablewise and not word_wise and also exclude sigils like #, % or / from these stops.
Example:
|$here_she_goes_again; #the pipe marks my cursor position
With one Ctrl+Right, I want to land on the space before the semicolon,
$here_she_goes_again|; #the pipe marks my cursor position
then, with a Ctrl+Left, I want to return to the beginning of the line.
|$here_she_goes_again; #the pipe marks my cursor position
Somebody got this to work?
Put this into your settings.json:
"[javascript]": {
"editor.wordSeparators": "`~!##%^&*()-=+[{]}\|;:'",.<>/?"
}
Use whatever your language identifier is. I deleted the $ from the default separators to get your example to work for javascript. You can remove the other characters you indicated. The underscore was already not in the default for me. Just make sure those characters are not in the language-specific setting shown above.
You can use the extension Select By and the command moveby.regex
You are able to define a regex to search and bind this to Ctrl+Left and another to Ctrl+Right
In the key binding you can limit this to a particular languageID.
I want to add small straight line onto some desired characters/numbers inside a string inside textview. I couldn't find a solution. Maybe using NSMutableAttributedString. Meanwhile, I mean doing this programmatically. There is strikethrough style, but not overstrike style. Or maybe adding the letters "a" and "_" with different .baseline values. But how to add both characters onto each other then?
Is it possible?
EDIT: Due to make a try for the helpful answers below, I think to make the line at a spesific height is needed. "A\u{0305}" makes the up line very close to the character, as if it sticks. Is there a way to make it at specific height? For example, if we assume that all the keyboard-inputted characters are written inside every single boxes, the ceiling side of these boxes could be lined?
So this (note: see edit below) appears to be an "a tilde ogonek" (it's Lithuanian).
You can write it for instance as follows using these two Unicode characters:
let atildeogonek = "\u{0105}\u{0303}"
let title = "How to add a small straight line (I mean like this: \(atildeogonek)) onto a character inside a string?"
The first character is the a with an ogonek, the second one is the tilde.
EDIT: The initial question specifically asked about the character ą̃ ("a tilde ogonek") in the title, and I used this code to demonstrate how to use Unicode characters in a Swift string. After posting this answer, the question was edited to be more general about "a line above a character".
Programmatically, you could use a function like this:
func overline(character: Character) -> Character? {
return "\(character)\u{0305}".first
}
That will take a character as input and return a new character (glyph) that has had the Unicode combining overline character added to it. It will return nil if adding the combining overline character fails.
The code print(overline(character:"A")!), for example, returns "A̅"
Or, if you want to add an overline to every character in a string, you could use a function like this:
func overline(characters: String) -> [Character?] {
return Array(characters).map { return "\($0)\u{0305}".first
}
}
(I'm not sure if there are any characters for which the above will fail, so I'm not sure if force-unwrapping the result is safe. Thus I left the result of both functions to be optional Character/Array of Character.)
You can easily find the unicodes of ā or ą̃ by using the xcode's own Character Viewer. Just follow the following steps :
hit : Control + Command + SpaceBar
If you get a compact one like this, click the upper right corner icon to expand it.
When expanded, Click the settings gear in the corner . Select customize list.
select Enclosed Characters
Go down to the bottom and open Code tables then add Unicode.
Now, just search for your required Character and you can check its unicode value. here i am searching ā
to print unicode's value :
print("\u{0101}")
I have strokes between numbers that I don't recognise on my keyboard:-
|9|1|
I need to be able to say, if "1" is included in the field include in selection, else exclude. For ";" I have used the following formula, but I don't know what the stroke is?
SUBSTRING(JobSites,6,CHARINDEX('I',JobSites))
Any help appreciated.
Laura
The stroke is a vertical line (Unicode 007C, or Chr(124)), and is commonly referred to as the pipe character, as in pipe-delimited text such as you have posted here. It's typically produced by Shift+\ (the shift key + the backslash key) on most US keyboard layouts.
I believe what you're trying to do can be solved using LIKE:
SELECT <your fields> FROM <your table> WHERE job LIKE '%|1|%`
In org-mode, I want to give inline code with equals signs and quotation marks:
<div class="foo">
The way I would normally do this in org-mode is
=<div class="foo">=
When I export this to HTML, it gets rendered like this:
<div class"foo">=
What is the right way to do this inline (rather than just creating a source block)?
You could use verbatim markers, ~, instead:
~<div class="foo">~
The problem is that the equals sign after 'class' is interpreted as the closing code section delimiter. You can prevent this by inserting a space before the equals sign, like this:
=<div class = "foo">=
I wanted org-mode's source code to appear correctly in Github's parser. But, just as =:echo "hello"= would not appear correctly in Emacs, it also did not appear correctly in Github. However, I tried other characters with C-x 8 RET, and the LEFT DOUBLE QUOTATION MARK and RIGHT DOUBLE QUOTATION MARK work. That is,
=:echo “hello“=
appear successfully as
:echo “hello“
Unfortunately, I don't think they will actually work if copy-and-pasted into all environments. Vim gives E15: Invalid expression: “hello“. But then, how often do we paste commands into Vim's command line. Well, okay, there is :#".
After almost a decade, here's the correct answer:
Org's escape character is zero width space. When this character is inserted, Emacs will not interpret = as the end of the verbatim. Emacs can correctly interpret =<div class="foo">=. Note that this string has an invisible zero width space character.
However, I think due to a bug, exports from org to other formats, will have this character and need to be removed manually. For example, the export of the string above to markdown will be `<div class="foo">` which is what we want, except that it has an additional zero width space character.
It is not very hard to fix this. Removing all these additional characters can be easily done with replace-string command.
Tip: You can use C-x 8 RET (or insert-char command) and choose 200B to insert zero width space character inside Emacs.
I'm finally giving up the angle bracket tax imposed on me by Microsoft's XML documentation format (and what's the point, since the MSVC environment still doesn't do anything fancy with it for C++ projects) and switching my current project to using Doxygen with a Javadoc style syntax.
It is fantastic. The inline documentation is much easier to read and type, and the generated output is so much more useful and versatile. In particular, I have the MULTILINE_CPP_IS_BRIEF option turned on, which allows me to write as long of a "brief" description as I want, and then break up my "details" documentation into paragraphs using blank lines. In other words:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// #param dx The amount, in pixels, to shift the visible region horizontally.
/// #param dy The amount, in pixels, to shift the visible region vertically.
///
/// #remarks
/// Note that this function is reentrant, but not thread-safe!
void ScrollRegion(int dx, int dy);
This gives me exactly the output I desire, while keeping down the number of noisy meta-commands like #brief and \details that I have to use.
The problem comes when I try to include a second paragraph in my "remarks" section, just like I did (implicitly) for the "details" section. For example:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// #param dx The amount, in pixels, to shift the visible region horizontally.
/// #param dy The amount, in pixels, to shift the visible region vertically.
///
/// #remarks
/// Note that this function is reentrant, but not thread-safe!
///
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
The generated output does not interpret the second paragraph in the #remarks section as part of the remarks. I can tell because it is not indented to the same level in the HTML output, and it is not located under the <simplesect kind="remark"> tag in the XML output.
I tried adding a #par command to the beginning of the second paragraph, but that didn't do what I wanted, either. The new paragraph is still not a child of the "remarks" section. In the XML output, it is getting placed inside of a new <simplesect kind="para"> tag that is a sibling of the original <simplesect kind="remark"> tag.
While researching this, I saw that someone else had duplicated the #remarks command:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// #param dx The amount, in pixels, to shift the visible region horizontally.
/// #param dy The amount, in pixels, to shift the visible region vertically.
///
/// #remarks
/// Note that this function is reentrant, but not thread-safe!
/// #remarks
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
That does produce the output that I desire. Both paragraphs are nested in <para> tags under the <simplesect kind="remark"> tag in the XML output, and the visual relationship is correct in the HTML output. But that's ugly and looks like a mistake to me.
Is there a standard way to do this that I'm missing? Surely I'm not the first person to want multiple paragraphs in the "remarks" section of my documentation... And this isn't limited to #remarks; the same thing happens with #internal, for example.
I have the latest version of Doxygen installed (1.8.2), but I very much doubt that this is version-specific.
Your final example code, that is
/// #remarks
/// Note that this function is reentrant, but not thread-safe!
/// #remarks
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
is exactly the expected use of \remarks for multi-paragraph comment blocks. From the doxygen manual (emphasis mine):
\remark { remark text }
Starts a paragraph where one or more remarks may be entered. The paragraph will be indented. The text of the paragraph has no special internal structure. All visual enhancement commands may be used inside the paragraph. Multiple adjacent \remark commands will be joined into a single paragraph. Each remark will start on a new line. Alternatively, one \remark command may mention several remarks. The \remark command ends when a blank line or some other sectioning command is encountered.
So \remark (and \remarks, which is just the same as \remark) ends at the end of a paragraph, but adjacent \remarks will be stitched together to form one \remark block.
You are right to say that this behaviour is not limited to \remarks and \remark. The same applies to any command that takes a paragraph of text as an argument, see, for example, \bug, \todo, \warning etc.
One solution that seems to work that I haven't seen mentioned here, is to end your lines with \n. This will keep everything grouped together, while putting in the white space you may want to see.
If you want a blank line, make sure the line above has \n, and you have a blank line with \n on it.
In your example, you would want:
/// #remarks
/// Note that this function is reentrant, but not thread-safe!\n
/// \n
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
And that should make it appear as you want it to appear.
If you don't like having multiple #remarks lines in your source for your multi-paragraph remarks, I think you can use #parblock & #endparblock to include multiple paragraphs for a single #remark.
The solutions can be generalized (doxygen 1.8.9.1). I used:
/// \par Title
/// text of paragraph 1\n
///
/// text of paragraph 2\n
///
/// ~~~
/// Some code / sketch
/// ~~~
kjkAe4Wbasj6
The three paragraphs are indented and the header Title is printed in bold letters above them. Of course, \par Title can be replaced with \remark. The magic phrase is the \n at the end of the paragraphs and blank lines can be inserted optionally. No \n is required in the blank lines. Unfortunately I have not found a way to append another indented text paragraph following the code section.