Skip to content

Commit

Permalink
Merge pull request #4650 from unisonweb/cp/speedup-docs-to-html
Browse files Browse the repository at this point in the history
Speed up docs.to-html by not using root-branch
  • Loading branch information
aryairani authored Jan 30, 2024
2 parents 44e2c21 + b7c8bb8 commit 54f64a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions unison-cli/src/Unison/Codebase/Editor/HandleInput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ loop e = do
Cli.respond $ Output.MarkdownOut (Text.intercalate "\n---\n" mdText)
DocsToHtmlI namespacePath' sourceDirectory -> do
Cli.Env {codebase, sandboxedRuntime} <- ask
rootBranch <- Cli.getRootBranch
absPath <- Path.unabsolute <$> Cli.resolvePath' namespacePath'
_evalErrs <- liftIO $ (Backend.docsInBranchToHtmlFiles sandboxedRuntime codebase rootBranch absPath sourceDirectory)
absPath <- Cli.resolvePath' namespacePath'
branch <- liftIO $ Codebase.getBranchAtPath codebase absPath
_evalErrs <- liftIO $ (Backend.docsInBranchToHtmlFiles sandboxedRuntime codebase branch sourceDirectory)
pure ()
AliasTermI src' dest' -> do
Cli.Env {codebase} <- ask
Expand Down
4 changes: 1 addition & 3 deletions unison-share-api/src/Unison/Server/Backend.hs
Original file line number Diff line number Diff line change
Expand Up @@ -911,13 +911,11 @@ docsInBranchToHtmlFiles ::
Rt.Runtime Symbol ->
Codebase IO Symbol Ann ->
Branch IO ->
Path ->
FilePath ->
-- Returns any doc evaluation errors which may have occurred.
-- Note that all docs will still be rendered even if there are errors.
IO [Rt.Error]
docsInBranchToHtmlFiles runtime codebase root currentPath directory = do
let currentBranch = Branch.getAt' currentPath root
docsInBranchToHtmlFiles runtime codebase currentBranch directory = do
let allTerms = (R.toList . Branch.deepTerms . Branch.head) currentBranch
-- ignores docs inside lib namespace, recursively
let notLib (_, name) = "lib" `notElem` Name.segments name
Expand Down

0 comments on commit 54f64a5

Please sign in to comment.