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

Support for `ifdef Compiler Directives #92

Closed velidurmuscan closed 1 year ago

velidurmuscan commented 1 year ago

Hey, lines of code might also change depending on the compiler directives. For example, see the code below, for SystemVerilog. How can I pass these kind of input to the VS Code Counter, so that it will count only the enabled IFDEF code section.

`ifdef FEATURE_1
    code_a;
    code_b;
`elsif FEATURE_2
    code_c;
    code_d;
`endif
uctakeoff commented 1 year ago

Is this code SystemVerilog? ChatGPT told me so.

VSCodeCounter counts only the basic syntax of the language so that it can work reasonably well for such an unknown language. In other words, it is designed to be able to approximate even unknown languages rather than to measure them accurately.

It is very difficult to modify the measurement to work correctly for macroscopic non-standard grammars.

We apologize for not meeting your expectations.

velidurmuscan commented 1 year ago

Thank you so much for your reply. This version itself is really nice. Maybe, future versions might have it.

Best wishes