title says everything plus:
- development language Lua
- code revision control system - Perforce (integrated with IntelliJ IDE)
Posting for posterity - This was the top Google entry when searching "intellij count lines of code" (without quotes)
.
If you're like me and didn't want to install anything else, you can hack it via the native, global search:
Ctrl + Shift + F (to open global search)
Use regex mode (check "regex" checkbox)
In the searchbox, enter only a caret "^" (without the quotes)
You may want to limit the search to a specific directory, via the "directory" tab
Hit the "Open in Find Window" button on the bottom-right
If it asks whether you want to continue, press "Continue"
.
Notes:
In regex, the caret (^) denotes the start of a line, except when inside square brackets, in which case it denotes negation
If you wanted to count non-empty lines, you could instead use "^.*\S" (without quotes), which signifies "The start of a line (^), followed by any number of characters (except newline) (.*), followed by a non-whitespace character (\S)"
You can either turn on the display of lines of code for a single file by right clicking in the left gutter and highlighting "display lines of code". Or you can do it for your entire project by downloading the Statistic plug-in. It's very nice indeed, because it shows LOC and other metrics for your entire project.
Related
I have a TDrawGrid where I am using its OnDrawCell event, and in there the Canvas.TextRect() method is used to fill out the cells with strings. One of the strings contains an &, but it gets displayed as an underscore _.
I don't see anything wrong, there is nothing fancy with this grid, and elsewhere it seems to work fine. Also the debugger confirms that the string is correct when passing it to Canvas.TextRect().
What am I missing?
Delphi 11, 64-bit, Windows 11.
This is expected. In Microsoft Windows, menu items, buttons, and control labels use an underscore to indicate the corresponding keyboard shortcut, and this underlined character is indicated using a prefix ampersand in code.
For instance, the &File menu item (displayed as File with F underlined) can be accessed by pressing Alt+F. A &Save button (displayed as Save with S underlined) may be invoked by pressing Alt+S (or only S if the currently focused control doesn't accept character input). You can set focus to a text field with label &Name: (displayed as Name: with N underlined) by pressing Alt+N.
This is why a string like Lost & Found is displayed as Lost _Found in Windows.
If you don't want ampersands to be treated as accelerator character indicators, simply use the tfNoPrefix flag:
Canvas.TextRect(R, S, [tfNoPrefix])
This VCL flag corresponds to the Win32 API DT_NOPREFIX flag:
Turns off processing of prefix characters. Normally, DrawText interprets the mnemonic-prefix character & as a directive to underscore the character that follows, and the mnemonic-prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off.
Hi, I have this data of Bricks which are separated by Next line, I want all to be in the from of Last Line. I can't do it manually one by one because it's very huge data. Can anyone please guide me the easiest way or built in functionality of notepad or notepad++. Thank you
Click the link to see my file and data.
Regards,
Mubasher Aqeel
Use "Line Operations" to remove line breaks
You just need to remove the new lines. Using Notepad++ that is as simple as:
Ctrl + A (to select everything)
Press Ctrl + J (which is the shortcut for "Edit → Line Operations → Join Lines")
Use search/replace
Alternatively you can do it more manually using:
Ctrl + H (Replace)
Choose "extended" under "Search Mode" and replace occurrences of "\r\n" (line breaks) with a blank.
Given the following text
Node1_L1
Node1_L2
Node2_L2
Node2_L1
Node3_L2
Node1_L3
Node2_L3
Node4_L2
Node3_L3
Node4_L3
Node3_L1
Node5_L2
Node6_L2
I can use vscode's built-in folding feature to fold it to look like so
+ Node1_L1
Node2_L1
+ Node3_L2
+ Node4_L2
Node3_L1
Node5_L2
Node6_L2
but when I now select the folded text and copy & paste it then it actually grabbed all text - also the hidden one. The result of copy & paste of the first 4 lines of the folded text above would therefore be
Node1_L1
Node1_L2
Node2_L2
Node2_L1
Node3_L2
Node1_L3
Node2_L3
Node4_L2
whereas I would like to have
Node1_L1
Node2_L1
Node3_L2
Node4_L2
Hope that makes sense and someone knows a way to do it. Thanks!
Maybe there is another way of doing it but a workaround seems to be using block selection with multiple cursors - see the GIF
If the selection doesn't include the new line and carriage return, folded content will not be copied.
The selection must go to the start of the next line to select the folded text ( hidden text )
https://github.com/Microsoft/vscode/issues/41922#issuecomment-359368290
The op actually wants to select 'unfolded' text ignoring the folded text so they need to use a multi-line select where each selection will span a single line
Here is a simple lists where I like to change the numbers: the entries are as below and it got over 300 entries like it
tom112
smith113
harry114
linda115
cindy106
samantha147
It need to be changed to
tom212
smith213
harry214
...and so on.
Please assist using notepad++ regular expression.
Thanks.
Assuming it's just a matter of replacing a name followed by a number starting with 1 with the same number but starting with 2 instead:
Ctrl + H for search & replace.
Check Regular expression under Search Mode.
Next to Find what type or copy in ([a-zA-Z]+)1([0-9]+).
Next to Replace with type or copy in \12\2.
Click Replace All and that should do it.
Add any other characters that might appear in the name before the number inside the first set of brackets with a-zA-Z.
I usually use Geany or Hi-Tide under Debian (GNU/Linux) for firmware development, mainly C (but also reading old assembler). I document code using single-line comments, and it really annoys me when I retype something and have to manually re-break every following line to keep it in the 80-character margin.
Is there a text editor that can re-wrap consecutive single-line comments (and do this automatically while I type)? That is, given:
/// This is a really long line that should have been wrapped at "that" but was not.
/// This sentence is in the same
/// paragraph as the last.
...I want an editor that will re-wrap this to
/// This is a really long line that
/// should have been wrapped at "that"
/// but was not. This sentence is in
/// the same paragraph as the last.
...preferably doing this sensibly while I type.
I've tried:
Hi-Tide (based on Eclipse 3.3)
Geany
jEdit
UniversalIndentGUI + a bunch of prettifiers (I couldn't find any formatters that worked, and it's not a great workflow either)
GVim - next line begins //should have been... instead of /// should have been...
Update: just to elaborate on my accepted answer - I've gone with the snapshot emacs and an extra filladapt mode was also required
In Emacs, to start automatic wrapping, enter auto-fill-mode. To set the line width, run C-u ⟨columns⟩ C-x f.
Emacs, or really CC Mode, will anticipate your commenting structure, so that typing
/// This is a really long line that shoul will result in
/// This is a really long line that
/// shoul‸
And you can refill a paragraph at any time with M-q.
If you want to do refills automatically with each keypress, well there may well be some interal command or third-party library out there, but off-hand you can use this elisp code:
;;; Can't advise SELF-INSERT-COMMAND, so create a wrapper procedure.
(defun self-insert-refill (n)
(interactive "p")
(self-insert-command n))
;;; Advise SELF-INSERT-REFILL to execute FILL-PARAGRAPH after every
;;; keypress, but *only* if we're inside a comment
(defadvice self-insert-refill (after refill-paragraph)
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))) )
(if (and (eq face 'font-lock-comment-face)
(not (string= " " (this-command-keys)))) ; Spaces would get deleted on refill.
(fill-paragraph))))
(ad-activate 'self-insert-refill)
(add-hook 'c-mode-hook
;; Remap SELF-INSERT-COMMAND to be SELF-INSERT-REFILL.
(local-set-key [remap self-insert-command] 'self-insert-refill) ))
This is probably not very robust or in keeping with best-practice, and likely not wholly satisfactory, as it won't work for general editing, e.g. C-d and backspace, and it slows down the editor somewhat, but it's a start.
Vim most certainly can do this.
First, you need to tell Vim that "///" is a comment prefix (it isn't by default):
:set comments^=:///
If you want wrapping to occur as-you-type, set your preferred textwidth:
:set textwidth=80
To format existing paragraphs, use any variation of the gq command. For example, you could:
Select a paragraph visually and type gq, or
Type gqj to re-wrap from the current line to the end of the paragraph