From e8c156573f80f7993532bff4e620958355a7754c Mon Sep 17 00:00:00 2001 From: Matthew Manela Date: Wed, 31 Jul 2024 13:38:13 -0400 Subject: [PATCH 1/3] feat(Search): Add support for all Apex language extensions --- internal/languages/language.go | 8 ++++++++ internal/languages/language_test.go | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/languages/language.go b/internal/languages/language.go index 7f1110757..4356487f1 100644 --- a/internal/languages/language.go +++ b/internal/languages/language.go @@ -16,6 +16,9 @@ import ( ) var unsupportedByLinguistAliasMap = map[string]string{ + // Extensions that are for the Apex programming languages + // See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm + "apex": "Apex", // Pkl Configuration Language (https://pkl-lang.org/) // Add to linguist on 6/7/24 // can remove once go-enry package updates @@ -26,6 +29,11 @@ var unsupportedByLinguistAliasMap = map[string]string{ } var unsupportedByLinguistExtensionToNameMap = map[string]string{ + ".apex": "Apex", + ".apxt": "Apex", + ".apxc": "Apex", + ".cls": "Apex", + ".trigger": "Apex", // Pkl Configuration Language (https://pkl-lang.org/) ".pkl": "Pkl", // Magik Language diff --git a/internal/languages/language_test.go b/internal/languages/language_test.go index 294c67776..25e2382a0 100644 --- a/internal/languages/language_test.go +++ b/internal/languages/language_test.go @@ -39,6 +39,12 @@ func TestGetLanguageByAlias(t *testing.T) { want: "Magik", wantOk: true, }, + { + name: "apex example unsupported by linguist alias", + alias: "apex", + want: "Apex", + wantOk: true, + }, } for _, tt := range tests { @@ -77,11 +83,17 @@ func TestGetLanguage(t *testing.T) { want: "Go", }, { - name: "unsupported by linguist extension", + name: "magik: unsupported by linguist extension", filename: "file.magik", content: []byte(""), want: "Magik", }, + { + name: "apex: unsupported by linguist extension", + filename: "file.apxc", + content: []byte(""), + want: "Apex", + }, } for _, tt := range tests { From 232fedc9d8a2363ae80b8a7e15a364545a1de900 Mon Sep 17 00:00:00 2001 From: Matthew Manela Date: Wed, 31 Jul 2024 13:57:52 -0400 Subject: [PATCH 2/3] clean up comment --- internal/languages/language.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/languages/language.go b/internal/languages/language.go index 4356487f1..75c6cdc12 100644 --- a/internal/languages/language.go +++ b/internal/languages/language.go @@ -16,7 +16,7 @@ import ( ) var unsupportedByLinguistAliasMap = map[string]string{ - // Extensions that are for the Apex programming languages + // Extensions for the Apex programming languages // See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm "apex": "Apex", // Pkl Configuration Language (https://pkl-lang.org/) From 21a750c6b1ef3b771291440ee1551c8a0c6edde0 Mon Sep 17 00:00:00 2001 From: Matthew Manela Date: Wed, 31 Jul 2024 15:46:20 -0400 Subject: [PATCH 3/3] Fix typo --- internal/languages/language.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/languages/language.go b/internal/languages/language.go index 75c6cdc12..ec76d9458 100644 --- a/internal/languages/language.go +++ b/internal/languages/language.go @@ -16,7 +16,7 @@ import ( ) var unsupportedByLinguistAliasMap = map[string]string{ - // Extensions for the Apex programming languages + // Extensions for the Apex programming language // See https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm "apex": "Apex", // Pkl Configuration Language (https://pkl-lang.org/)