uctakeoff / vscode-counter Goto Github PK
View Code? Open in Web Editor NEWVS Code extension: counts blank lines, comment lines, and physical lines of source code in many programming languages.
License: MIT License
VS Code extension: counts blank lines, comment lines, and physical lines of source code in many programming languages.
License: MIT License
When I select Count lines in workspace, it prompts for a folder selection and if you select a folder, it only counts lines in that folder. I would think it should not prompt for anything and just iterate over all folders in the workspace.
I need to start this extension from the panel every time after restart VSCode. I haven't found a related option in the settings.
Could you please add an option to toggle to autostart of this extension? Thanks!
I'm trying this extensipn and when pick the option 'count lines in directory' I get the message: [VSCodeCounter] There was no target file.
I'm using the extension with .prg - harbour - files.
Can you help me ?
Regards
How do you make it ignore some directories? Seems like it might be ignoring node_modules
already, is there a way to control this and add more directories to that ignore list?
Latest version on Mac OS Latest.
[2020-09-03 11:42:05.070] [renderer1] [error] command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
: Error: command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
at Object.t.deserializeSearchError (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5072:889)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5152:906
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5151:8
[2020-09-03 11:42:55.330] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:42:55.331] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:43:00.333] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:43:00.333] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:43:05.896] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:43:05.973] [renderer1] [info] Setting search error: XHR timeout: 5000ms
[2020-09-03 11:44:24.672] [renderer1] [error] command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
: Error: command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
at Object.t.deserializeSearchError (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5072:889)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5152:906
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5151:8
[2020-09-03 11:46:41.734] [renderer1] [error] command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
: Error: command failed with error code 2: error parsing glob '!/{/.gitignore,/.vscode/,/node_modules/,/.git,/.svn,/.hg,/CVS,/.DS_Store,/.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/.js: { "when": "$(basename).ts" },.VSCodeCounter,/.git,/.svn,/.hg,/CVS,/.DS_Store,/*.js: { "when": "$(basename).ts" },.VSCodeCounter}': nested alternate groups are not allowed
at Object.t.deserializeSearchError (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5072:889)
at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5152:906
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:5151:8
First of all thanks @uctakeoff for this app which enables to visualize the growth of the codebase in a simple way
can an optional parameter be implemented to add to the result table 3 new columns (biggest, smallest, average) of lines of code of each row type
I happy to use it.
I just to request one more feature. If you provide filter more strong product.
It is similar question #1 issue but If user can filter out UI. It will be more convenient.
Example) I want to filter out some specific folder.
\bin
\obj
\obj\Debug
\obj\Release
\packages
Any plan or schedule to support github.dev ?
Hi,how can I deal with the .vue file?
Can you help me ?
Regards
Using current version in Marketplace. When I move extension ".h" from "C++" to "C" in settings.json, it gets put back to "C++" for no reason. I do not have any C++ in my project, and any .h-file is a C-file to me, and I want it counted as such.
It seems like a bug to me, but maybe I do something wrong?
Need to calculate the comment rate, thanks
Hello.
When i am trying to use the extension, i encounter the following error message in console and nothing happens:
rejected promise not handled within 1 second: EntryNotFound (FileSystemError): Unable to resolve nonexistent file 'd:\Users\Win10\Desktop\Visual Studio\Visual Studio Code\Projects\test-stuff\.VSCodeCounter'
stack trace: EntryNotFound (FileSystemError): Unable to resolve nonexistent file 'd:\Users\Win10\Desktop\Visual Studio\Visual Studio Code\Projects\test-stuff\.VSCodeCounter'
Some info:
Operating System: Windows 10 Pro
Architecture: 64 Bit
VSCode Version: 1.63.2 (user setup)
Extension Version: 3.0.0
Cool looking plugin! Unfortunately my source code is behind a symlink, and it looks like this doesn't work with symlinks. Here's the output of the Developer Console when I try to run "Count Line in Directory":
[Extension Host] [VSCodeCounter] 2020-03-31T18:30:12.112Z uctakeoff.vscode-counter ver.1.3.3 now active! : c:\Users\A9FZGZZ\.vscode\extensions\uctakeoff.vscode-counter-1.3.3
console.ts:137 [Extension Host]% Object
t.log @ console.ts:137
console.ts:137 [Extension Host]% Object
t.log @ console.ts:137
console.ts:137 [Extension Host]% Object
t.log @ console.ts:137
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.249Z build CodeCounter start
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.257Z associations : 1[*.json,jsonc]
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.261Z create CodeCounter end
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.262Z countLinesInDirectory : file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface/src/app, output dir: file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface/.VSCodeCounter
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.263Z includes : "**/*"
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.263Z excludes : "**/.gitignore", "**/.vscode/**", "**/node_modules/**", "**/.git", "**/.svn", "**/.hg", "**/CVS", "**/.DS_Store", "[App]sal-user-interface/.VSCodeCounter"
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.535Z target : 124 files -> use .gitignore
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.751Z target : 124 files
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.877Z count 124 files
console.ts:137 [Extension Host] [VSCodeCounter] 2020-03-31T18:31:08.877Z OutputDir : file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface/.VSCodeCounter
console.ts:137 [Extension Host] makeDirectories file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface/.VSCodeCounter
console.ts:137 [Extension Host] makeDirectories file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface
console.ts:137 [Extension Host] Unhandled Rejection: file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface is not directory.
console.ts:137 [Extension Host] rejected promise not handled within 1 second: file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface is not directory.
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
(anonymous) @ rpcProtocol.ts:101
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
log.ts:197 ERR file:///c%3A/AIMDev/Projects/StreamlinedActiveLearning/Web/Applications/sal-user-interface is not directory.
Doing line counts for the whole project also doesn't work. Thanks for a cool line counter!
My whole project is written in typescript and VSCodeCounter ignores all .ts files.This is relevant only when I connect to a remote directory using Remote-SSH.
When I execute "count lines in directory" on a directory e.g. named "swcMatrix" and there is a 2nd directory which has the same name included, e.g. "swcMatrixLedController", the 2nd directory is counted additionally in the result, here the file result.md:
`# Summary
Date : 2021-02-04 06:31:49
Directory u:\app\swcMatrix
Total : 21 files, 5348 codes, 1184 comments, 1025 blanks, all 7557 lines
language | files | code | comment | blank | total |
---|---|---|---|---|---|
C | 10 | 4,520 | 966 | 816 | 6,302 |
C++ | 11 | 828 | 218 | 209 | 1,255 |
path | files | code | comment | blank | total |
---|---|---|---|---|---|
. | 21 | 5,348 | 1,184 | 1,025 | 7,557 |
.. | 15 | 3,924 | 493 | 727 | 5,144 |
..\swcMatrixLedController | 15 | 3,924 | 493 | 727 | 5,144 |
..\swcMatrixLedController\include | 8 | 741 | 166 | 169 | 1,076 |
..\swcMatrixLedController\src | 7 | 3,183 | 327 | 558 | 4,068 |
include | 3 | 87 | 52 | 40 | 179 |
src | 3 | 1,337 | 639 | 258 | 2,234 |
VS Code Counter version: v2.2.1
Could this issue please be fixed?
remove *
:
"activationEvents": [
"*",
"onCommand:extension.vscode-counter.countInFile",
"onCommand:extension.vscode-counter.countInDirectory",
"onCommand:extension.vscode-counter.countInWorkspace",
"onCommand:extension.vscode-counter.outputAvailableLanguages"
]
I tried to count lines in my Rust project. And it just doesn't work. Is the language supported?
Create option to choose wheter real time counter is for current file or whole workspace (all file extensios). Futurely, file extensions could be chosen too.
Is there a way to add file types to the "known" file types? I would like to be able to count Razor files (*.cshtml, .vbhtml), and Web Form files (.aspx, *.ashx).
Maybe this could be added as a configuration setting so the extension doesn't have to know all of them?
Is there config option or method to make the command to toggle real-time counter visibility automatically on start?
Hi,
I see this issue was raised and closed before but I can't seem to get VSCodeCounter to ignore directories or files. In my user and workspace settings.json files I have placed the following:
"files.exclude": {
"**/.git": true, // this is a default value
"**/.DS_Store": true, // this is a default value
"**/data/PCAP/**": true,
"**/data/PCAP/extract_files/**": true,
"**/data/CSV/**": true,
"**/data/failed_code_samples/**": true
},
"VSCodeCounter.useGitignore": true,
"VSCodeCounter.useFilesExclude": true
When I run VSCodeCounter it shows all the CSV/JavaScript/HTML files even though all of these directories are listed in "files.exclude" and are stored in .gitignore (although I see on the last issue about this that the .gitignore functionality wasn't actually implemented)
Any ideas what's wrong? It could very well be settings syntax but I'm struggling to find any good examples online..
Thanks,
CryptoCat
Hi, I like this extension, it's pretty awesome!
I just have one request, I have to do this:
"VSCodeCounter.exclude": [
// ignore the output directory or it will be counted it on subsequent counts
".VSCodeCounter"
]
or if I run it again it adds the output files from running this extension to the totals.
My Vscode version is 1.43.2. and Programming language is PHP. When I click to "count line in the Directory " is show me this message "[VSCodeCounter] there was no target file." this is an excellent extension, could you please fix the issue.
I had this desire from long but wasn't able to get the stats like this. Amazing work dude. You made it much easy <3
Loved the way it generates the reports seriously <3
Is it possible to designate JSON files inside a folder a different language?
I see that filename is an option but not folder name, and I understand there's a directory view below.
This will give me control to create a better summary view up top.
No matter what I try, be it workspace, directory I get the error: [VSCodeCounter] There was no target file.
Version is showing as 2.2.1 and I'm using the latest fully-up-to-date version of VSCode
I "walked back" the versions... anything below 1.3.1 works , nothing above 1.3.0 works, all failing with the error above
it does not work. When do you plan to do this feature?
Hi!
I'm on Ubuntu Linux using VS Code 1.40.0 and VSCode Counter 1.2.1.
When I try to count lines in a directory, I get the following error message:
[VSCodeCounter] Error has occurred.
The console log shows the following:
console.ts:137 [Extension Host] [VSCodeCounter] countLinesInDirectory : /home/chross/Dropbox/Codebase, Project.Sys/ihg console.ts:137 [Extension Host] [VSCodeCounter] associations : 1[*.xml,xml] console.ts:137 [Extension Host] [VSCodeCounter] target : 545 files console.ts:137 [Extension Host] [VSCodeCounter] use gitignore : /home/chross/Dropbox/Codebase, Project.Sys/project_shared/phpword/.gitignore console.ts:137 [Extension Host] [VSCodeCounter] use gitignore : /home/chross/Dropbox/Codebase, Project.Sys/project_shared/phpword/samples/results/.gitignore console.ts:137 [Extension Host] [VSCodeCounter] target : 545 files notificationsAlerts.ts:40 [VSCodeCounter] Error has occurred. onDidNotificationChange @ notificationsAlerts.ts:40 (anonymous) @ notificationsAlerts.ts:26 fire @ event.ts:580 addNotification @ notifications.ts:171 notify @ notificationService.ts:101 (anonymous) @ mainThreadMessageService.ts:83 _showMessage @ mainThreadMessageService.ts:44 $showMessage @ mainThreadMessageService.ts:38 _doInvokeHandler @ rpcProtocol.ts:398 _invokeHandler @ rpcProtocol.ts:383 _receiveRequest @ rpcProtocol.ts:299 _receiveOneMessage @ rpcProtocol.ts:226 (anonymous) @ rpcProtocol.ts:101 fire @ event.ts:580 fire @ ipc.net.ts:453 _receiveMessage @ ipc.net.ts:733 (anonymous) @ ipc.net.ts:592 fire @ event.ts:580 acceptChunk @ ipc.net.ts:239 (anonymous) @ ipc.net.ts:200 t @ ipc.net.ts:28 emit @ events.js:200 addChunk @ _stream_readable.js:294 readableAddChunk @ _stream_readable.js:275 Readable.push @ _stream_readable.js:210 onStreamRead @ internal/stream_base_commons.js:166
Could the dir name be the reason?
Visual Code Studio version: 1.60.2 (user setup)
VS Code Counter version: V2.3.0
CloneをLocalに作成して、コードのカウントを行おうとしましたが、
ディレクトリ内のコードが数えられません。コードファイルは存在します。
Error MSG="The "input" argument must be an instance of ArrayBuffer or ArrayBufferView. Received null"
何が原因か分かりません。
Can count selected code instead of the whole file?
Hello,
great extension.
It would be great as an improvement/added feature if it could be possible to count for a custom text or a regexpr.
Would that be possible?
The end goal would be to count for called function ecc, that would make the tool even more complete.
vscode version: 1.39.2 installed the latest vscode-counter, I want to counter typescript language, but nothing happen!
I click count line in the Directory
, it show me [VSCodeCounter] there was no target file
. In this directory, there are just serveral js files. I try other usage given by doc and still not working with js file.
I execute VSCodeCounter: Check Available Language
and the javascript config is aliases[JavaScript,javascript,js], extensions[.js,.es6,.mjs,.cjs,.pac], filenames:[jakefile]
.
I'm confused about filenames:[jakefile]
. I'm not sure whether the jakefile
causing js files undetectable. I don't know how to override the property filename
in settings.json.
In tsx files, comment in element was not counted.
{/* Bulletin Board Card */}
<BulletinBoardCard
title={title}
content={content}
address={address}
contributor={contributor}
publishStart={publishStart}
publishEnd={publishEnd}
onClick={onClick}
/>
comment like {/* Bulletin Board Card*/}
was not recognized to comment.
How to use a customized setting for different project, and not use the global setting?
For example, my global settings.json is configured as below
global settings.json file path: ~/Library/Application Support/Code/User/settings.json
{
"VSCodeCounter.exclude": [
"**/node_modules/**",
]}
but I want ignore "**/static/**"
in my local project, when I configure in local settings.json, it does not work.
local settings.json file path: /Users/xxx/local_project/.vscode/settings.json
{
"VSCodeCounter.exclude": [
"**/node_modules/**",
"**/static/**"
]
}
Is there a way to set ignores for local project? Thank you.
Counter is very good to count file.
I also want to count per author code line with git-blame.
My project has a lot of files with commas in the names.
eg xml files that are used for test cases
if the test case is "TestStatusForType(1,2,3)"
then there will be a file "TestStatusForType(1,2,3)_expectedresult.xml"
This causes a problem because the commas are not in synch with the expected output in CSV format
The result would be better if the filename is always wrapped in double quotes for CSV output
(but possibly you would need to also remove/escape quotes that are embedded in the filename :) )
Any plan or schedule to support Kotlin
?
I'm receiving the following on workspaces with large numbers of files when running "VSCodeCounter: Count lines in workspace"...
<path to file> Read Error : EMFILE: too many open files, open <path to file>
I have been able to get around in some projects with excludes, but would be nice to not have to exclude files.
I have following entry in my .gitignore
which is perfectly valid:
venv*/
Git successfully ignores matching folders, but VS Code Counter still counts them in.
I want to count my c++ codes in my remote service, but it said There was no target file. I'm sure I have installed the C/C++ package.
Sometimes when you have a large table or graph output, the number of output lines dominates the whole project. Should the notebook outputs be excluded from the count?
A new tab appears like in the README GIF
Nothing happens
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.