Comments (3)
Thank you for your issue! However tokei is correct here. All doc comments in Rust are markdown and this code is invalid Rust because it needs to be attached to an item.
from tokei.
Thank you for the clarification!
For the following code snippet, is the result from tokei also correct?
const demo: &str = "Hello, World!";
/// markdown? docstring?
const demo1: &str = "Hello, World!";
Output:
[2024-03-07T04:45:50Z TRACE tokei::language::language_type] const demo: &str = "Hello, World!";
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] Start "\""
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] End "\""
[2024-03-07T04:45:50Z TRACE tokei::language::syntax]
[2024-03-07T04:45:50Z TRACE tokei::language::syntax]
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] /// markdown? docstring?
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] Markdown found: " markdown? docstring?\n"
[2024-03-07T04:45:50Z TRACE tokei::language::language_type] markdown? docstring?
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] ^ Skippable
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] Comment No.1
[2024-03-07T04:45:50Z TRACE tokei::language::language_type] const demo1: &str = "Hello, World!";
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] Start "\""
[2024-03-07T04:45:50Z TRACE tokei::language::syntax] End "\""
[2024-03-07T04:45:50Z TRACE tokei::language::language_type] const demo1: &str = "Hello, World!";
[2024-03-07T04:45:50Z TRACE tokei::language::language_type] Code No.1
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 1 1 1 0 0
|- Markdown 1 1 0 1 0
(Total) 2 1 1 0
===============================================================================
Total 1 1 1 0 0
===============================================================================
IMHO, LoC should be 2 here?
A correct example is:
const demo: u8 = 42;
/// markdown? docstring?
const demo1: &str = "Hello, World!";
Output:
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] Using Simple Parse on "const demo: u8 = 42;\n\n"
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] /// markdown? docstring?
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] /// markdown? docstring?
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] Markdown found: " markdown? docstring?\n"
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] markdown? docstring?
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] ^ Skippable
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] Comment No.1
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] const demo1: &str = "Hello, World!";
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] Start "\""
[2024-03-07T06:18:40Z TRACE tokei::language::syntax] End "\""
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] const demo1: &str = "Hello, World!";
[2024-03-07T06:18:40Z TRACE tokei::language::language_type] Code No.1
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 1 3 2 0 1
|- Markdown 1 1 0 1 0
(Total) 4 2 1 1
===============================================================================
Total 1 3 2 0 1
===============================================================================
from tokei.
A similar issue is #713 , my guess is that the early return at https://github.com/XAMPPRocky/tokei/blob/master/src/language/syntax.rs#L250-L252 somehow affected the counting of previous lines when there is a quote.
from tokei.
Related Issues (20)
- How are the filenames listed by the '--files' option ordered?
- Increase small height to tokei widget
- Can you support ignoring reports?
- Use as library
- windows output broken by #896
- Ignore files extensions by regex
- Add the ability to exclude test code/custom blocks
- All repositories have 0 lines of code HOT 3
- Jupyter notebook (`.ipynb`) is blowing the number of lines out of proportion HOT 2
- installation of v13.0.0-alpha.1 HOT 7
- Add support for per-project custom DSL sloc HOT 1
- Tokei performance issues with binary files
- [Feature request]capnproto schema file
- not a 時計 but 統計 HOT 2
- Hare & Headache conflict
- The value of `hidden` in the config file is not respected
- [Feature Request] Auto publish image to ghcr.io HOT 1
- self-hosting guidelines
- support for Mojo language
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokei.