mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-23 23:05:35 +03:00
Avoid recomputing graph twice when a module changes
This commit is contained in:
parent
74835eca7c
commit
3c906ef844
@ -98,26 +98,25 @@ and for which a parsing error will be reported when running [`Review.review`](./
|
||||
-}
|
||||
addModule : { path : String, source : String } -> Project -> Project
|
||||
addModule { path, source } project =
|
||||
recomputeModuleGraphIfNeeded <|
|
||||
case parseSource source of
|
||||
Ok ast ->
|
||||
project
|
||||
|> addModuleToProject
|
||||
{ path = path
|
||||
, source = source
|
||||
, ast = ast
|
||||
}
|
||||
|> removeFileFromFilesThatFailedToParse path
|
||||
|> recomputeModuleGraphIfNeeded
|
||||
case parseSource source of
|
||||
Ok ast ->
|
||||
project
|
||||
|> addModuleToProject
|
||||
{ path = path
|
||||
, source = source
|
||||
, ast = ast
|
||||
}
|
||||
|> removeFileFromFilesThatFailedToParse path
|
||||
|> recomputeModuleGraphIfNeeded
|
||||
|
||||
Err _ ->
|
||||
project
|
||||
|> removeFileFromProject path
|
||||
|> addFileThatFailedToParse
|
||||
{ path = path
|
||||
, source = source
|
||||
}
|
||||
|> recomputeModuleGraphIfNeeded
|
||||
Err _ ->
|
||||
project
|
||||
|> removeFileFromProject path
|
||||
|> addFileThatFailedToParse
|
||||
{ path = path
|
||||
, source = source
|
||||
}
|
||||
|> recomputeModuleGraphIfNeeded
|
||||
|
||||
|
||||
positionAsInt : { row : Int, column : Int } -> Int
|
||||
|
Loading…
Reference in New Issue
Block a user