From d01db4817416105aac28106fe29762218e14b193 Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Wed, 20 Sep 2023 09:05:37 +1200 Subject: [PATCH 1/9] chore: add Glimmer to languages --- lib/linguist/languages.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 88c425287f..7ed09ad1a6 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2416,6 +2416,14 @@ Gleam: - ".gleam" tm_scope: source.gleam language_id: 1054258749 +Glimmer: + type: programming + extensions: + - ".gjs" + - ".gts" + ace_mode: javascript + color: "#F5835F" + tm_scope: source.js Glyph: type: programming color: "#c1ac7f" From 22bd9e209da0f88d9b74478bd782e57032113ffe Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 12:05:26 +1200 Subject: [PATCH 2/9] chore: add vsc-ember-syntax grammer script/add-grammar https://github.com/lifeart/vsc-ember-syntax Note: I removed `text.html.handlebars` from the `vsc-ember-syntax` in grammars.yml to (hopefully) avoid conficting with the existing Handlebars syntax which is also provided by `vsc-ember-syntax`. --- .gitmodules | 3 +++ grammars.yml | 5 ++++ vendor/README.md | 1 + vendor/grammars/vsc-ember-syntax | 1 + .../git_submodule/vsc-ember-syntax.dep.yml | 24 +++++++++++++++++++ 5 files changed, 34 insertions(+) create mode 160000 vendor/grammars/vsc-ember-syntax create mode 100644 vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml diff --git a/.gitmodules b/.gitmodules index e14f0bf03f..34167f404b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/grammars.yml b/grammars.yml index cf9da731c7..6a96cab22f 100644 --- a/grammars.yml +++ b/grammars.yml @@ -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: diff --git a/vendor/README.md b/vendor/README.md index 67f1d452b0..8528d9009a 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -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:** [atom/language-javascript](https://github.com/atom/language-javascript) - **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) diff --git a/vendor/grammars/vsc-ember-syntax b/vendor/grammars/vsc-ember-syntax new file mode 160000 index 0000000000..55ca698120 --- /dev/null +++ b/vendor/grammars/vsc-ember-syntax @@ -0,0 +1 @@ +Subproject commit 55ca6981204a1f3934b55057a5a7abbab66a1d8e diff --git a/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml b/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml new file mode 100644 index 0000000000..a019809887 --- /dev/null +++ b/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml @@ -0,0 +1,24 @@ +--- +name: vsc-ember-syntax +version: 55ca6981204a1f3934b55057a5a7abbab66a1d8e +type: git_submodule +homepage: https://github.com/lifeart/vsc-ember-syntax.git +license: other +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: [] From c45a58e33669f5738e95de10a42e2e0684dc2e25 Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 12:58:24 +1200 Subject: [PATCH 3/9] chore: add Glimmer samples --- samples/Glimmer/class.gjs | 48 +++++++++++++++++++++++++ samples/Glimmer/class.gts | 58 +++++++++++++++++++++++++++++++ samples/Glimmer/template-only.gjs | 55 +++++++++++++++++++++++++++++ samples/Glimmer/template-only.gts | 48 +++++++++++++++++++++++++ 4 files changed, 209 insertions(+) create mode 100644 samples/Glimmer/class.gjs create mode 100644 samples/Glimmer/class.gts create mode 100644 samples/Glimmer/template-only.gjs create mode 100644 samples/Glimmer/template-only.gts diff --git a/samples/Glimmer/class.gjs b/samples/Glimmer/class.gjs new file mode 100644 index 0000000000..58ec0443ce --- /dev/null +++ b/samples/Glimmer/class.gjs @@ -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 { + + + @action + triggerConfirmChanges() { + this.args.closeModal(); + this.args.confirm(); + } +} \ No newline at end of file diff --git a/samples/Glimmer/class.gts b/samples/Glimmer/class.gts new file mode 100644 index 0000000000..d767144c63 --- /dev/null +++ b/samples/Glimmer/class.gts @@ -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??? + } + +} \ No newline at end of file diff --git a/samples/Glimmer/template-only.gjs b/samples/Glimmer/template-only.gjs new file mode 100644 index 0000000000..603deb912b --- /dev/null +++ b/samples/Glimmer/template-only.gjs @@ -0,0 +1,55 @@ +import { ExternalLink, Link } from '@crowdstrike/ember-oss-docs'; + +export const Footer = + +export default Footer; \ No newline at end of file diff --git a/samples/Glimmer/template-only.gts b/samples/Glimmer/template-only.gts new file mode 100644 index 0000000000..05b2892cd1 --- /dev/null +++ b/samples/Glimmer/template-only.gts @@ -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 } }> = ; + +export default ResourceCard; \ No newline at end of file From d08c018106c5ce9dcd156d5d8ed811c2a1f55768 Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 12:59:40 +1200 Subject: [PATCH 4/9] chore: generate language id for Glimmer --- lib/linguist/languages.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7ed09ad1a6..6335770734 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2419,11 +2419,12 @@ Gleam: Glimmer: type: programming extensions: - - ".gjs" - - ".gts" + - ".gjs" + - ".gts" ace_mode: javascript color: "#F5835F" tm_scope: source.js + language_id: 735100269 Glyph: type: programming color: "#c1ac7f" From 555c882f9d5b6f1b0bfcd4d91d30562fc7a3f9cf Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 13:30:29 +1200 Subject: [PATCH 5/9] chore: added a naive heuristic to disambiguate .gts files between Gerber Image and Glimmer languages --- lib/linguist/heuristics.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index 8fb4243867..cbb1f4c742 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -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 From 7ab0d9f52c7ffd351a791a0ccf65c9753724707b Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 13:53:51 +1200 Subject: [PATCH 6/9] test: add heuristic test for gts files --- test/test_heuristics.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 8c14018c8d..3456dd144e 100755 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -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"), From daec167d351c383b94a9fd33fb8d3d5d2766a8de Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Fri, 22 Sep 2023 14:26:42 +1200 Subject: [PATCH 7/9] chore: correct vendor readme entry for Glimmer --- vendor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/README.md b/vendor/README.md index 8528d9009a..b51a3ba997 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -202,7 +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:** [atom/language-javascript](https://github.com/atom/language-javascript) +- **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) From 9a525d5f2d30d8e365c709c6d4fd061978c2933a Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sat, 23 Sep 2023 04:56:31 +0200 Subject: [PATCH 8/9] Update vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml --- vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml b/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml index a019809887..e196782a71 100644 --- a/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml +++ b/vendor/licenses/git_submodule/vsc-ember-syntax.dep.yml @@ -3,7 +3,7 @@ name: vsc-ember-syntax version: 55ca6981204a1f3934b55057a5a7abbab66a1d8e type: git_submodule homepage: https://github.com/lifeart/vsc-ember-syntax.git -license: other +license: mit licenses: - sources: LICENSE.md text: "Copyright (c) 2021 Aleksandr Kanunnikov, and contributors.\n\nAll rights From 86e12f7a963157c2f8327106cbb54570695747ca Mon Sep 17 00:00:00 2001 From: Giles Thompson Date: Tue, 10 Oct 2023 10:04:57 +1300 Subject: [PATCH 9/9] revert: correct vendor readme entry for Glimmer Because otherwise it fails the TestGrammars#test_readme_file_is_in_sync test. Not sure why this URL is considered not in sync. Maybe because of `ace_mode: javascript`? --- vendor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/README.md b/vendor/README.md index b51a3ba997..8528d9009a 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -202,7 +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) +- **Glimmer:** [atom/language-javascript](https://github.com/atom/language-javascript) - **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)