uctakeoff / vscode-counter

VS Code extension: counts blank lines, comment lines, and physical lines of source code in many programming languages.
MIT License
152 stars 20 forks source link

Adding a "custom" regex to count for #29

Closed maxdd closed 3 years ago

maxdd commented 4 years ago

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.

uctakeoff commented 4 years ago

Actually, this extension does not support very complex rules. However, you can implement a few custom rules with the following configuration.

For example, here is an example configuration for JavaScript.

settings.json

   "VSCodeCounter.languages": {
          :
        "javascript": {
            "aliases": [
                "JavaScript"
            ],
            "filenames": [
                "jakefile"
            ],
            "extensions": [
                ".js",
                ".es6",
                ".mjs",
                ".cjs",
                ".pac"
            ],
            "lineComments": [
                "//"
            ],
            "blockComments": [
                [
                    "/*",
                    "*/"
                ]
            ],
            "blockStrings": []
        },
           :
  },

The new command "Save the collected language configurations" collects information about other language extensions and stores it in a configuration file You can . for your reference.

maxdd commented 4 years ago

Ok so the file to modify is the local settings.json