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

feat(Search): Add support for all Apex language extensions #799

Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading