If i want to implement following comment in shorts-cut, what should i do ?
I found shift+alt+j only comment before method body, i just want to comment in method.
thanks in advance
/**
** #modify by grandstream
** #oginal functions 将原先的代码注释 在这部分
** #desc 说明修改的原因
** start modify
*/
xxxxxxxxxx 新的代码
xxxxxxxxx
/**
** end modify
*/
You can define a template (Window>Preferences>Java>Editor>Templates). Insert your comments there, you can use ${line_selection} as a placeholder for the lines that are selected when you use the template.
Such templates are then "Surround with"-Templates, the shortcut for a list of them ist Shift + Alt + Z. So select your code xxxxx, press the Shift + Alt + Z and select your new template to insert the comments.
Related
I have this snippet.
SELECT 'SELECT * FROM ' + OBJECT_SCHEMA_NAME(o.object_id, DB_ID(${20:})) + '.' + name,
*
FROM ${20/$/./}sys.all_objects o
WHERE name LIKE '%${10:hadr}%'
ORDER BY o.name;
And this is how it works:
When the user types something in the function DB_ID(), I hope the content the user typed appears before sys.all_objects AND append an additional .. It already works like this as it shown in the above gif. However, I also hope if the user types nothing in the function DB_ID(), don't add . before sys.all_objects. Is this possible?
No need to add the : in field 2:
DB_ID(${2})
Use field 2
${2/(.*)/$1${1:+.}/}
capture all the typed text: (.*)
replace it with all the typed text: $1
followed by a . if the typed text is not empty: ${1:+.}
You can use lookbehind to assert that there's something in that field: (?<=.)$. For a minimal example, let's say this is the original snippet:
foo($1); ${1/$/./}bar()
Change it to:
foo($1); ${1/(?<=.)$/./}bar()
If I type something, e.g. x, then press Tab, I get:
foo(x); x.bar()
If I don't type anything then press Tab, I get:
foo(); bar()
I'm currently documenting a C code which is not from me.
Either than commenting the code, and then making blocks for Doxygen documentation, I prefer to put comments after each line of code (with ///) in order to implement directly everything in Doxygen.
So far it works very well but I'm not able to generate lists and paragraphs. It seams that list and paragraph are reinitialized each time I start a new comment on next line with ///
Is there something I am missing ?
[EDIT] : an exemple :
So this works perfectly fine, if I put it before my function :
/**
* 1. Title 1. \n
* Description 1. \n
* More description \n
* - Subtitle1. \n
* - Subtitle2. \n
* Description of subtitle2 \n
* 2. Title 2. \n
* Description 2.
*/
But this don't work at all, if I put it INSIDE my function :
Some code /// 1. Title 1. \n
other code /// Description 1. \n
x=x /// More description \n
y=x /// - Subtitle1. \n
code /// - Subtitle2. \n
code /// Description of subtitle2 \n
code /// 2. Title 2. \n
code /// Description 2.
It behaves like if each line was a new comment block.
Thank you,
I would like to define a snippet for comments like
//************
//* foo A1 *
//************
where I enter foo A1 and it would create a line with (6+ len(${1}) asterisks etc. - is that doable and if so, how?
While I am a big proponent of HyperSnips (see
[VSCODE]: Is there a way to insert N times the same characters,
VS Code: how to make a python snippet that after string or expression hitting tab will transform it and
VSCode Advanced Custom Snippets for how to use it),
it is instructive to see how to do this with just the built-in snippet functionality in vscode. Here is a snippet that does what you want:
"Custom Comment": {
"prefix": ["cc2"], // whatever trigger you want, then tab, write your info and tab again
"body": [
"//***${1/./*/g}***",
"//* $1 *",
"//***${1/./*/g}***"
]
},
That just adds 3 asterisks to the beginning and 3 to the end of your added comment, each character of which is replaced by an asterisk as well.
You can use the extension HyperSnips
snippet comment "Comment" A
``rv = '//' + '*'.repeat(t[0].length + 6)``
//* $1 *
``rv = '//' + '*'.repeat(t[0].length + 6)``
endsnippet
I wish to create macro in Netbeans to put block comment over function. I have preference of code formatting over file save. So When I close file it saves code automatically and format it.
Issue is when I create function and comment it. It unformatted my whole block of code like this.
/**
*function abc(){
*var a, b = 50;
*}
*/
I wish to create comment like this. so it keep my coding properly formatted as well.
/*
|
| function abc(){
| var a, b = 50;
| }
|
*/
You can add your own macro by Following this instructions:
Edit->Start Macro Recording
Edit->Stop Macro Recirding
It Will pop-up one Box For Editor Macros->Add Your Choice of Macro Name
In code area add Your custom comment code in " your code "; Like,
Blockquote
"/*
|
| function abc(){
| var a, b = 50;
| }
|
*/"
Assign a Short Cut Key to your Custom Macro.
That's It
Though I couldn't find macro for the same. But I found alternative. Use Ctrl+Shift+R toggle, for multiple line action at same time & add pipeline sign. But it take extra effort for starting and ending comment.
I have an application written in Powerbuilder 11.5 that automatically fills in form fields of a Word document (MS Word 2003).
The Word document is protected so only the form fields can be altered.
In the code below you can see I use char(10) + char(13) to insert a newline, however in the saved document all I see is 2 little squares where the characters should be.
I've also tried using "~r~n", this also just prints 2 squares.
When I fill in the form manually I can insert newlines as much as I want.
Is there anything else I can try? Or does anybody know of a different way to fill in word forms using Powerbuilder?
//1 Shipper
ls_value = ids_form_info.object.shipper_name[1]
if not isnull(ids_form_info.object.shipper_address2[1]) then
ls_value += char(10) + char(13) + ids_form_info.object.shipper_address2[1]
end if
if not isnull(ids_form_info.object.shipper_address4[1]) then
ls_value += char(10) + char(13) + ids_form_info.object.shipper_address4[1]
end if
if not isnull(ids_form_info.object.shipper_country[1]) then
ls_value += char(10) + char(13) + ids_form_info.object.shipper_country[1]
end if
if lnv_word.f_inserttextatbookmark( 'shipper', ls_value ) = -1 then return -1
The f_inserttextatbookmark is as follows:
public function integer f_inserttextatbookmark (string as_bookmark, string as_text, string as_fontname, integer ai_fontsize);
if isnull(as_text) then return 0
iole_word = create OLEOBJECT
iole_word.connectToNewobject( "word.application" )
iole_word.Documents.open( <string to word doc> )
iole_word.ActiveDocument.FormFields.Item(as_bookmark).Result = as_text
return 1
end function
Part of your problem is that carriage return is char(13), and line feed is char(10), so to make a CRLF in Windows and DOS you usually need to make char(13) + char(10). If these are out of order, many programs will balk. However, "~r~n" should have produced that for you.
I have success with (and I'm converting for brevity so it might only be close to correct):
lole_Word.ConnectToNewObject ("Word.Application")
...
lole_Word.Selection.TypeText (ls_StringForWord)
Maybe you can try other Word OLE commands to see if it's something to do with the specific command. (After the definition of the line break, I'm grasping at straws.)
Good luck,
Terry
Sounds like it may be a Unicode/Ansi character conversion thing.
for what its worth you could try this ...
http://www.rgagnon.com/pbdetails/pb-0263.html
Hope it helps.
I'm not using form fields, but I am able to insert newlines into a Word document from PowerBuilder using TypeText and "~n". Maybe you just need "~n".