uctakeoff / vscode-counter

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

How to add addtional File Types #4

Closed schallm closed 5 years ago

schallm commented 5 years ago

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?

uctakeoff commented 5 years ago

@schallm

This extension depends on "language extension". If you want to support unsupported file types, please install a language extension for that file type.

In the future, it may be modified to refer to "files.associations". However, it is not supported yet.

schallm commented 5 years ago

I can't seem to find an extension for (Razor for VB) vbhtml files. I do have it in the files.associations so that would be a great addition!

    "files.associations": {
        "*.vbhtml": "razor"
    },
uctakeoff commented 5 years ago

@schallm I implemented a prototype (ver. 1.1.1). Try it and let me know if there are any issues or suggestions.

schallm commented 5 years ago

This picked up my *.vbhtml files perfectly! I'll check on the other extensions when I have time.

Thanks for a great extension!

One suggestion unrelated to this ticket. The output can be huge for large directories. Maybe have 2 entries. "Count Lines in Workspace" and "Count Lines in Workspace (Summary)" that doesn't show file details. The results.md for my current project has 30,000 lines. VSCode doesn't handle a Markdown file that large very well... I can open a separate ticket for this if you want...

uctakeoff commented 5 years ago

@schallm Version 1.2.0 has been released. Added new configuration "VSCodeCounter.outputMarkdownSeparately" (default is true).

When this is true, 2 Markdown files are output. try it.

schallm commented 5 years ago

So much better! Thanks!