Lines of code (linecounter)
This project is forked from LineCount project. Author of the project is not resposing any PRs or Issue and he does not developed the extesion since 1 year. So, we have published the extension under a new name.
The Lines of code extension for Visual Studio Code counts and displays the lines of code, the lines of comment, the lines of blank.
Features
Count the number of lines of current opened file.
Count the number of lines of workspace files. Also, you can custom the includes/excludes file pattern.
Support languages: c,cpp,java,js,ts,cs(//,/*,*/ ),sql(--,/*,*/ ),pas(//,{*,*} ),perl(#,=pod,=cut ),ruby(#,=begin,=end ),python(#,''' ),vb(' ),html(<!--,--> ),bat(:: ),sh(# ),ini(; ),fortran(! ),m(% ).
You can customize the comment symbol, add new languages support.
Line number information can be output to JSON, TXT, CSV, Markdown file (MD).
Installs
git clone https://github.com/lyzerk/vscode-linecounter.git
cd linecount
npm install
code .
Extension Settings
LineCount.showStatusBarItem : (boolean|default true ) Show/hide the status bar item for LineCount commands.
LineCount.statistics : (boolean|default true ) Collecting the statistics of the operation (e.g. Workspace files, Current file)
LineCount.includes : (string array|default "**/*" ) Search files pattern.
LineCount.excludes : (string array|default "**/.vscode/**,**/node_modules/**" ) files and folders that you want exclude them.
LineCount.output.txt : (boolean | default true ) Whether output to TXT file.
LineCount.output.json : (boolean | default true ) Whether output to JSON file.
LineCount.output.csv : (boolean | default false ) Whether output to CSV file.
LineCount.output.md : (boolean | default false ) Whether output to markdown file and preview.
LineCount.output.outdir : (string | default out ) output file path.
LineCount.sort : (string enum | default filename ) Specifies the sort field.
LineCount.order : (string enum | default asc ) Specify ascending or descending order.
LineCount.comment.ext : (string array| required) file extension. if it`s "*", the rule for other files. default c style.
LineCount.comment.separator.linecomment : (string |default none) Single line comment symbol.
LineCount.comment.separator.linetol : (boolean |default false ) Whether the line comment must be started on the line.
LineCount.comment.separator.blockstart : (string |default none) Block start comment symbol.
LineCount.comment.separator.blockend : (string |default none) Block end comment symbol.
LineCount.comment.separator.blocktol : (boolean |default false ) Whether the block comment must be started on the line.
LineCount.comment.separator.string.doublequotes : (boolean |default true ) String using double quotes.
LineCount.comment.separator.string.singlequotes : (boolean |default true ) String using single quotes.
LineCount configuration examples:
"LineCount.showStatusBarItem": true,
"LineCount.statistics": true,
"LineCount.includes": [
"**/*"
],
"LineCount.excludes": [
"**/.vscode/**",
"**/node_modules/**"
],
"LineCount.output": {
"txt": true,
"json": true,
"csv": true,
"md": true,
"outdir":"out"
},
"LineCount.sort": "filename",
"LineCount.order": "asc",
"LineCount.comment":[
{
"ext": ["c","cpp","java"],
"separator": {
"linecomment": "//",
"linetol":false,
"blockstart": "/*",
"blockend": "*/",
"blocktol": false,
"string":{
"doublequotes": true,
"singlequotes": true
}
}
},
{
"ext": ["html"],
"separator": {
"blockstart": "<!--",
"blockend": "-->",
}
}
]
Usage
There are two commands available.
You can access them from the command palette (Ctrl+Shift+P on Windows/Linux), or click StatusBarItem 'LineCount'.
- LineCount: Count current file:
- LineCount: Count Workspace files:
Support
Repository
License
MIT
Enjoy!
| |