Skip to content

Commit 0cc6573

Browse files
Allow Talon formatter to use text to determine if its a list for unknown file endings
1 parent a6dba05 commit 0cc6573

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/cli/talonFormatter.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void main({
1010
fileEndings: ["talon", "talon-list"],
1111

1212
format: async (text, options, fileName) => {
13-
if (fileName.endsWith(".talon-list")) {
13+
if (isListFile(text, fileName)) {
1414
const updated = talonListFormatter(text, options);
1515
return Promise.resolve(updated);
1616
}
@@ -19,3 +19,13 @@ void main({
1919
return talonFormatter(node, options);
2020
},
2121
});
22+
23+
function isListFile(text: string, fileName: string): boolean {
24+
if (fileName.endsWith(".talon-list")) {
25+
return true;
26+
}
27+
if (fileName.endsWith(".talon")) {
28+
return false;
29+
}
30+
return text.startsWith("list:");
31+
}

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
"forceConsistentCasingInFileNames": true,
1616
"noImplicitReturns": true
1717
},
18-
"include": ["src"],
19-
"exclude": ["src/test", "src/cli", "src/build.ts"]
18+
"include": ["src"]
2019
}

0 commit comments

Comments
 (0)