mirror of https://github.com/XAMPPRocky/tokei
Add support for Glimmer JS/TS (#1052)
* feat: add glimmer lang support * tests: add glimmer lang test files * fix: use js comment matches * tests: add style block example * fix: use template tag * feat: add template multiline comments to gjs/gts * fix(tests): comment line include heads * tests: add template comment examples * fix(test): rename test file as it doesn't like dashes * fix: no hbs comments
This commit is contained in:
parent
2645a116d1
commit
612981e4a8
|
|
@ -598,6 +598,22 @@
|
|||
"quotes": [["\\\"", "\\\""]],
|
||||
"extensions": ["gleam"]
|
||||
},
|
||||
"GlimmerJs": {
|
||||
"name": "Glimmer JS",
|
||||
"line_comment": ["//"],
|
||||
"multi_line_comments": [["/*", "*/"], ["<!--", "-->"]],
|
||||
"quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]],
|
||||
"important_syntax": ["<template", "<style"],
|
||||
"extensions": ["gjs"]
|
||||
},
|
||||
"GlimmerTs": {
|
||||
"name": "Glimmer TS",
|
||||
"line_comment": ["//"],
|
||||
"multi_line_comments": [["/*", "*/"], ["<!--", "-->"]],
|
||||
"quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]],
|
||||
"important_syntax": ["<template", "<style"],
|
||||
"extensions": ["gts"]
|
||||
},
|
||||
"Glsl": {
|
||||
"name": "GLSL",
|
||||
"line_comment": ["//"],
|
||||
|
|
|
|||
|
|
@ -171,7 +171,9 @@ impl<'a> RegexCache<'a> {
|
|||
LanguageType::Html
|
||||
| LanguageType::RubyHtml
|
||||
| LanguageType::Svelte
|
||||
| LanguageType::Vue => {
|
||||
| LanguageType::Vue
|
||||
| LanguageType::GlimmerJs
|
||||
| LanguageType::GlimmerTs => {
|
||||
let html = HtmlLike {
|
||||
start_script: save_captures(&START_SCRIPT, lines, start, end),
|
||||
start_style: save_captures(&START_STYLE, lines, start, end),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
// 27 lines, 18 code, 6 comments, 3 blanks
|
||||
import { helper } from '@ember/component/helper';
|
||||
import { modifier } from 'ember-modifier';
|
||||
|
||||
// A single-line comment
|
||||
const plusOne = helper(([num]) => num + 1);
|
||||
|
||||
/**
|
||||
* A multi-line comment
|
||||
*/
|
||||
const setScrollPosition = modifier((element, [position]) => {
|
||||
element.scrollTop = position
|
||||
});
|
||||
|
||||
<template>
|
||||
<!-- A HTML-like comment -->
|
||||
<div class="scroll-container" {{setScrollPosition @scrollPos}}>
|
||||
{{#each @items as |item index|}}
|
||||
Item #{{plusOne index}}: {{item}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<style>
|
||||
div {
|
||||
background-color: #E04E39;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// 18 lines, 10 code, 6 comments, 2 blanks
|
||||
import type { TemplateOnlyComponent } from '@glimmer/component';
|
||||
|
||||
// A single-line comment
|
||||
const localVariable = 'foo';
|
||||
|
||||
/**
|
||||
* A multi-line comment
|
||||
*/
|
||||
const Greet: TemplateOnlyComponent<{ name: string }> = <template>
|
||||
<!-- A HTML-like comment -->
|
||||
<p>Hello, {{@name}}! {{localVariable}}</p>
|
||||
<style>
|
||||
p {
|
||||
background-color: #E04E39;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
Loading…
Reference in New Issue