Skip to content

Commit

Permalink
feat(Search): Add support for all Apex language extensions (#799)
Browse files Browse the repository at this point in the history
* feat(Search): Add support for all Apex language extensions

* clean up comment

* Fix typo
  • Loading branch information
mmanela authored Aug 1, 2024
1 parent c01b6c7 commit bbd1fed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions internal/languages/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 13 additions & 1 deletion internal/languages/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bbd1fed

Please sign in to comment.