← every case · 6000 · another language inside the file

6100-block_language_named_by_the_tag

the opening tag names the language of its block, so this file is Vue, TypeScript and SCSS and not Vue, JavaScript and CSS. Every count comes out the same either way, so nothing but the names themselves can tell a counter that read the tags from one that guessed

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.vue
1code<template>
2code <p>x</p>
3code</template>
4code<script lang="ts">
5comments TypeScript// a ts comment
6code TypeScriptinterface Point { x: number }
7code</script>
8code<style lang="scss">
9comments SCSS// an scss line comment, which plain css does not have
10code SCSS.a { .b { color: red; } }
11code</style>

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the file is counted as one language from beginning to end and no lang attribute is read, so every number comes out right only because those symbols already treat // as a comment

the rules ask11 lines · 0 blanks · 9 code · 2 comments · SCSS 2 · TypeScript 2
it answers11 lines · 0 blanks · 9 code · 2 comments

cloc --json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue

mezura.content ✓ agrees
the rules ask11 lines · 9 code · 2 comments · 0 extra · SCSS 2 · TypeScript 2
it answers11 lines · 9 code · 2 comments · 0 extra · SCSS 2 · TypeScript 2

mezura cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue --output json --hide timing --counting content

mezura.region ✓ agrees
the rules ask11 lines · 0 blanks · 9 code · 2 comments · SCSS 2 · TypeScript 2
it answers11 lines · 0 blanks · 9 code · 2 comments · SCSS 2 · TypeScript 2

mezura cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue --output json --hide timing --counting region

scc.default ✗ fails

the file is counted as one language from beginning to end. The totals come out right because both block comment symbols happen to be the ones Vue's own markup already declares, and neither block is found

the rules ask11 lines · 0 blanks · 9 code · 2 comments · SCSS 2 · TypeScript 2
it answers11 lines · 0 blanks · 9 code · 2 comments

scc --format json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue

tokei.default ✗ fails

counts the same lines and calls the two blocks JavaScript and CSS, although each tag names its own language

the rules ask11 lines · 0 blanks · 9 code · 2 comments · HTML 1 · SCSS 2 · TypeScript 2
it answers11 lines · 0 blanks · 9 code · 2 comments · CSS 2 · HTML 1 · JavaScript 2

tokei --output json cases/6000-another_language_inside_the_file/6100-block_language_named_by_the_tag/input.vue