From bbd1fedfcd9d439681fc70defdbb4d75ac251245 Mon Sep 17 00:00:00 2001 From: Matthew Manela Date: Thu, 1 Aug 2024 10:49:14 -0400 Subject: [PATCH] feat(Search): Add support for all Apex language extensions (#799) * feat(Search): Add support for all Apex language extensions * clean up comment * Fix typo --- 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 7f111075..ec76d945 100644 --- a/internal/languages/language.go +++ b/internal/languages/language.go @@ -16,6 +16,9 @@ import ( ) var unsupportedByLinguistAliasMap = map[string]string{ + // 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/) // 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 294c6777..25e2382a 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 {