Count the number of valid lines of code in VSCode

how does vscode count valid lines of code?

Jun.29,2021

has a plug-in: line-counter


VSCode Counter

clipboard.png


recommends a code statistics tool cloc . You can count according to different file types, or you can remove spaces and comments.


the number of lines of code depends on the indentation of the code and the coding style, such as line breaks and comments. What is a valid number of lines of code? It doesn't seem to make any sense. The number of lines is for people, but for the computer, it doesn't care whether it is indented or not. After the code is compressed, there is only one line, but it runs faster.
if you really want to count, you can first comment
and then delete extra blank lines
you can get a valid number of lines of code


regular queries can be used in VSCode. Regular queries can be used directly, and the number of rows queried will be displayed. Note, however, that you should first set up "files to include" and "files to be excluded".

the rules are as follows:

^b*[^:b-sharp/]+.*$

removes all comments that begin with-sharp.

transferred from: python-zai-vscodezhong-tong-ji-you-xiao-dai-ma-xing-shu/" rel=" nofollow noreferrer "> http://www.zgljl2012.com/pyth.


did the landlord solve it? what did he use in the end?

Menu