Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Glimmer language #6556

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,9 @@
[submodule "vendor/grammars/vhdl"]
path = vendor/grammars/vhdl
url = https://github.com/textmate/vhdl.tmbundle
[submodule "vendor/grammars/vsc-ember-syntax"]
path = vendor/grammars/vsc-ember-syntax
url = https://github.com/lifeart/vsc-ember-syntax.git
[submodule "vendor/grammars/vsc-fennel"]
path = vendor/grammars/vsc-fennel
url = https://github.com/kongeor/vsc-fennel
Expand Down
5 changes: 5 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,11 @@ vendor/grammars/verilog.tmbundle:
- source.verilog
vendor/grammars/vhdl:
- source.vhdl
vendor/grammars/vsc-ember-syntax:
- inline.hbs
- inline.template
- source.gjs
- source.gts
vendor/grammars/vsc-fennel:
- source.fnl
vendor/grammars/vscode-TalonScript:
Expand Down
6 changes: 6 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ disambiguations:
rules:
- language: GSC
named_pattern: gsc
- extensions: ['.gts']
rules:
- language: Gerber Image
pattern: '^G0.'
- language: Glimmer
negative_pattern: '^G0.'
- extensions: ['.h']
rules:
- language: Objective-C
Expand Down
9 changes: 9 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,15 @@ Gleam:
- ".gleam"
tm_scope: source.gleam
language_id: 1054258749
Glimmer:
type: programming
extensions:
- ".gjs"
- ".gts"
ace_mode: javascript
color: "#F5835F"
tm_scope: source.js
language_id: 735100269
Glyph:
type: programming
color: "#c1ac7f"
Expand Down
48 changes: 48 additions & 0 deletions samples/Glimmer/class.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Component from "@glimmer/component";
import { action } from "@ember/object";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import DModalCancel from "discourse/components/d-modal-cancel";
import I18n from "I18n";
import { htmlSafe } from "@ember/template";

const t = I18n.t.bind(I18n);

export default class ModalDiffModal extends Component {
<template>
<DModal
class="composer-ai-helper-modal"
@title={{t "discourse_ai.ai_helper.context_menu.changes"}}
@closeModal={{@closeModal}}
>
<:body>
{{#if @diff}}
{{htmlSafe @diff}}
{{else}}
<div class="composer-ai-helper-modal__old-value">
{{@oldValue}}
</div>

<div class="composer-ai-helper-modal__new-value">
{{@newValue}}
</div>
{{/if}}
</:body>

<:footer>
<DButton
class="btn-primary confirm"
@action={{this.triggerConfirmChanges}}
@label="discourse_ai.ai_helper.context_menu.confirm"
/>
<DModalCancel @close={{@closeModal}} />
</:footer>
</DModal>
</template>

@action
triggerConfirmChanges() {
this.args.closeModal();
this.args.confirm();
}
}
58 changes: 58 additions & 0 deletions samples/Glimmer/class.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import Component from '@glimmer/component';
import FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
import BoxelInputTime, { Time } from './index';
import { tracked } from '@glimmer/tracking';
import { cssVariable, CSSVariableInfo } from 'ember-freestyle/decorators/css-variable';
import { fn } from '@ember/helper';
import { action } from '@ember/object';

export default class BoxelInputTimeUsage extends Component {
cssClassName = 'boxel-input-time';

@cssVariable declare boxelInputTimeBackgroundColor: CSSVariableInfo; // TODO: replace or remove
@tracked value = new Date(2022,2,3,13,45);
@tracked minValue = new Date(2022,2,3,11,0);
@tracked minuteInterval = 5;
@action timeChanged(val: Time) {
this.value = val as Date; //TODO: casting???
}
<template>
<FreestyleUsage @name="Input::Time">
<:description>
A succint version of a time picker.
</:description>
<:example>
<BoxelInputTime
@value={{this.value}}
@minValue={{this.minValue}}
@minuteInterval={{this.minuteInterval}}
@onChange={{this.timeChanged}}
/>
</:example>
<:api as |Args|>
<Args.Object
@name="value"
@description="The current value (undefined or conforming to a Time interface that is a subset of JavaScript's Date API"
@value={{this.value}}
@onInput={{fn (mut this.value)}}
/>
<Args.Object
@name="minValue"
@description="The times before this value will disabled"
@value={{this.minValue}}
/>
<Args.Number
@name="minuteInterval"
@description="The interval at which to show minute options"
@defaultValue={{5}}
@value={{this.minuteInterval}}
@onInput={{fn (mut this.minuteInterval)}}
/>
<Args.Action
@name="onChange"
@description="Called when the user changed the time"
/>
</:api>
</FreestyleUsage>
</template>
}
55 changes: 55 additions & 0 deletions samples/Glimmer/template-only.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { ExternalLink, Link } from '@crowdstrike/ember-oss-docs';

export const Footer = <template>
<footer class="bg-mezzanine theme-mezzanine pb-10 sm:pb-20 md:pb-28 pt-6 sm:pt-10 md:pt-20">
<div class="max-w-screen-lg mx-auto grid gap-4 md:gap-14">
<nav class="p-8 md:p-0 grid sm:flex flex-wrap justify-between">
<div class="flex flex-col items-start">
<Link @variant="quiet" @href="https://www.crowdstrike.com/why-crowdstrike/">Why CrowdStrike</Link>
<Link @variant="quiet" @href="https://www.crowdstrike.com/why-crowdstrike/crowdstrike-customers/">Our Customers</Link>
</div>
<div class="flex flex-col items-start">
<Link @variant="quiet" @href="https://www.crowdstrike.com/about-crowdstrike/">CrowdStrike's Story</Link>
<Link @variant="quiet" @href="http://www.crowdstrike.com/news/">CrowdStrike News and Releases</Link>
</div>
<div class="flex flex-col items-start">
<Link @variant="quiet" @href="https://www.crowdstrike.com/blog/category/engineering-and-technology/">CrowdStrike Engineering and Tech Blog CrowdStrike</Link>
<Link @variant="quiet" @href="#">CrowdStrike People and Culture</Link>
<Link @variant="quiet" @href="https://crowdstrike.wd5.myworkdayjobs.com/crowdstrikecareers">CrowdStrike Open Positions</Link>
</div>
</nav>

<div class="p-8 md:p-0 grid gap-4 md:grid-flow-col w-full items-center">
<ExternalLink @href="https://crowdstrike.com" class="mt-3 justify-self-start">
<img src="/logo_footer.png" alt="Visit crowdstrike.com" />
</ExternalLink>

<div class="md:justify-self-center text-body-and-labels type-xs">
<span class="px-2">Copyright &copy; 2023</span>
<span>|</span>
<ExternalLink @href="https://www.crowdstrike.com/contact-us/">Contact Us</ExternalLink>
<span>|</span>
<ExternalLink @href="https://www.crowdstrike.com/privacy-notice/">Private</ExternalLink>
<span>|</span>
<ExternalLink @href="https://www.crowdstrike.com/website-terms-of-use/">Terms of Use</ExternalLink>
<span>|</span>
<ExternalLink @href="https://www.crowdstrike.com/careers/candidate-privacy-notices/">Candidate Privacy Notices</ExternalLink>
</div>

<div class="md:justify-self-end flex gap-2 items-center">
<ExternalLink @href="https://www.youtube.com/user/CrowdStrike">
<img src="/youtube.png" alt="Visit the CrowdStrike YouTube channel" />
</ExternalLink>
<ExternalLink @href="https://www.instagram.com/crowdstrike/?hl=en">
<img src="/instagram.png" alt="Visit the CrowdStrike Instagram" />
</ExternalLink>
<ExternalLink @href="https://www.linkedin.com/company/crowdstrike">
<img src="/linkedin.png" alt="Visit the CrowdStrike LinkedIN" />
</ExternalLink>
</div>
</div>
</div>
</footer>
</template>

export default Footer;
48 changes: 48 additions & 0 deletions samples/Glimmer/template-only.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { LinkTo } from '@ember/routing';
import { TOC } from '@ember/component/template-only';
import Resource from 'ember-crate/models/resource';
import HeroIcon from 'ember-heroicons/components/hero-icon';

const formatDate = (date: Date) => {
const options: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', year: 'numeric' };
return new Intl.DateTimeFormat('en-US', options).format(new Date(date));
};

export const ResourceCard: TOC<{ Args: { resource: Resource } }> = <template>
<LinkTo
@route='resources.resource'
@model={{@resource.slug}}
class='block max-w-sm rounded-lg border border-gray-200 bg-white drop-shadow-sm hover:bg-slate-50'
>
<div class='p-3 md:p-4'>
<div class='flex gap-2'>
<h5
class='text-l mb-2 h-[3em] font-medium tracking-tight text-gray-900 line-clamp-2 xl:text-xl tracking-tight'
>{{@resource.title}}</h5>
{{#if @resource.isFeatured}}
<HeroIcon
@icon='star'
@type='solid'
class='mt-2 h-4 w-4 shrink-0 text-yellow-400'
/>
{{/if}}
</div>

<div
class='flex flex-col justify-between gap-2 lg:flex-row lg:items-center'
>
<div class='flex items-center text-sm text-slate-700'>
<HeroIcon @icon='clock' @type='outline' class='mr-2 h-4 w-4' />
<span>{{formatDate @resource.publishDate}}</span>
</div>
<div
class='w-fit grow-0 rounded bg-slate-100 px-2.5 py-0.5 text-xs font-medium text-slate-800'
>
{{@resource.type}}
</div>
</div>
</div>
</LinkTo>
</template>;

export default ResourceCard;
7 changes: 7 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ def test_gsh_by_heuristics
})
end

def test_gts_by_heuristics
assert_heuristics({
"Gerber" => all_fixtures("Gerber", "*.gts"),
"Glimmer" => all_fixtures("Glimmer", "*.gts"),
})
end

def test_h_by_heuristics
assert_heuristics({
"Objective-C" => all_fixtures("Objective-C", "*.h"),
Expand Down
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Git Config:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc)
- **Git Revision List:** [Nixinova/NovaGrammars](https://github.com/Nixinova/NovaGrammars)
- **Gleam:** [gleam-lang/tree-sitter-gleam](https://github.com/gleam-lang/tree-sitter-gleam) 🐌
- **Glimmer:** [lifeart/vsc-ember-syntax](https://github.com/lifeart/vsc-ember-syntax)
- **Glyph:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle)
- **Glyph Bitmap Distribution Format:** [Alhadis/language-fontforge](https://github.com/Alhadis/language-fontforge)
- **Gnuplot:** [mattfoster/gnuplot-tmbundle](https://github.com/mattfoster/gnuplot-tmbundle)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/vsc-ember-syntax
Submodule vsc-ember-syntax added at 55ca69
24 changes: 24 additions & 0 deletions vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: vsc-ember-syntax
version: 55ca6981204a1f3934b55057a5a7abbab66a1d8e
type: git_submodule
homepage: https://github.com/lifeart/vsc-ember-syntax.git
license: other
lildude marked this conversation as resolved.
Show resolved Hide resolved
licenses:
- sources: LICENSE.md
text: "Copyright (c) 2021 Aleksandr Kanunnikov, and contributors.\n\nAll rights
reserved. \n\nMIT License\n\nPermission is hereby granted, free of charge, to
any person obtaining a copy of this software and associated documentation files
(the \"Software\"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:\n\nThe above copyright
notice and this permission notice shall be included in all copies or substantial
portions of the Software.\n\nTHE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.\n"
notices: []