Skip to content

Commit

Permalink
implement requested changes, #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Totto16 committed Feb 1, 2025
1 parent b5239db commit af974c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ type FormatterDefinition = {
priority: number;
};

//NOTE: the highest priority number means it is tested first, the lowest is tested last
const formatters: Record<FormattingProvider, FormatterDefinition> = {
muon: {
format: muon.format,
check: muon.check,
priority: 1, // higher means less priority
priority: 0,
},
meson: {
format: meson.format,
check: meson.check,
priority: 0,
priority: 1,
},
};

Expand Down Expand Up @@ -49,7 +50,7 @@ async function getBestAvailableFormatter(provider: FormattingProvider | "auto"):
// sort the available providers by priority
const providerPriority: FormattingProvider[] = (Object.keys(formatters) as FormattingProvider[]).sort(
(provider1: FormattingProvider, provider2: FormattingProvider) => {
return formatters[provider1].priority - formatters[provider2].priority;
return formatters[provider2].priority - formatters[provider1].priority;
},
);

Expand Down

0 comments on commit af974c1

Please sign in to comment.