-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5258 from unisonweb/cp/global-search
- Loading branch information
Showing
19 changed files
with
303 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
unison-cli/src/Unison/Codebase/Editor/HandleInput/Global.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Unison.Codebase.Editor.HandleInput.Global (forAllProjectBranches) where | ||
|
||
import Control.Monad.Reader | ||
import U.Codebase.Sqlite.DbId (ProjectBranchId, ProjectId) | ||
import U.Codebase.Sqlite.Queries qualified as Q | ||
import Unison.Cli.Monad (Cli) | ||
import Unison.Cli.Monad qualified as Cli | ||
import Unison.Codebase qualified as Codebase | ||
import Unison.Codebase.Branch (Branch) | ||
import Unison.Core.Project | ||
import Unison.Prelude | ||
import Unison.Util.Monoid (foldMapM) | ||
|
||
-- | Map over ALL project branches in the codebase. | ||
-- This is a _very_ big hammer, that you should basically never use, except for things like debugging or migrations. | ||
forAllProjectBranches :: (Monoid r) => ((ProjectAndBranch ProjectName ProjectBranchName, ProjectAndBranch ProjectId ProjectBranchId) -> Branch IO -> Cli r) -> Cli r | ||
forAllProjectBranches f = do | ||
Cli.Env {codebase} <- ask | ||
projectBranches <- Cli.runTransaction Q.loadAllProjectBranchNamePairs | ||
projectBranches & foldMapM \(names, ids@(ProjectAndBranch projId branchId)) -> do | ||
b <- liftIO $ Codebase.expectProjectBranchRoot codebase projId branchId | ||
f (names, ids) b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.