Skip to content

Commit

Permalink
fix: scopesByFenceName type
Browse files Browse the repository at this point in the history
  • Loading branch information
lierdakil committed Mar 14, 2021
1 parent b1fcb52 commit 80749db
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const scopesByFenceName = {
const scopesByFenceName: { [key: string]: string | undefined } = {
bash: "source.shell",
sh: "source.shell",
powershell: "source.powershell",
Expand Down Expand Up @@ -42,11 +42,7 @@ const scopesByFenceName = {

export function scopeForFenceName(fenceName: string): string {
fenceName = fenceName.toLowerCase()
let result = `source.${fenceName}`
if (scopesByFenceName[fenceName] != null) {
result = scopesByFenceName[fenceName]
}
return result
return scopesByFenceName[fenceName] ?? `source.${fenceName}`
}

export function fenceNameForScope(scope: string): string {
Expand Down

0 comments on commit 80749db

Please sign in to comment.