Skip to content

Commit d57c3d7

Browse files
committed
Filter out any file not ending with .gren when running format
1 parent 7e43db8 commit d57c3d7

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

src/Terminal/Format.gren

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,26 @@ run { fsPermission, pathToString, projectPath, outline } =
4545
parseFn { path, source } previous =
4646
Task.andThen
4747
(\previousFiles ->
48-
let
49-
relPath =
50-
pathRelativeFrom projectPath path
51-
in
52-
when Parser.run PM.parser Context.empty source is
53-
Ok _ ->
54-
Task.succeed <|
55-
Array.pushLast (pathToString relPath) previousFiles
56-
57-
Err errs ->
58-
Task.fail <|
59-
ParseFailure
60-
{ path = relPath
61-
, error = PM.errorsToString source errs
62-
}
48+
if path.extension /= "gren" then
49+
-- Probably kernel code
50+
Task.succeed previousFiles
51+
52+
else
53+
let
54+
relPath =
55+
pathRelativeFrom projectPath path
56+
in
57+
when Parser.run PM.parser Context.empty source is
58+
Ok _ ->
59+
Task.succeed <|
60+
Array.pushLast (pathToString relPath) previousFiles
61+
62+
Err errs ->
63+
Task.fail <|
64+
ParseFailure
65+
{ path = relPath
66+
, error = PM.errorsToString source errs
67+
}
6368
)
6469
previous
6570
in

0 commit comments

Comments
 (0)