Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ jobs:

# Install ucm
mkdir ucm
curl -L https://github.com/unisonweb/unison/releases/download/release%2F0.5.25/ucm-linux.tar.gz | tar -xz -C ucm
curl -L https://github.com/unisonweb/unison/releases/download/release%2F0.5.33/ucm-linux-x64.tar.gz | tar -xz -C ucm
export PATH=$PWD/ucm:$PATH

# Clean up old postgres data if it exists.
Expand Down
8 changes: 8 additions & 0 deletions src/Share/Postgres/NameLookups/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Share.Postgres.NameLookups.Types
NameLookupReceipt (..),
pathSegmentsToText,
textToPathSegments,
nameToPathSegments,
reversedNameToNamespaceText,
reversedNameToPathSegments,
prefixNamedRef,
Expand All @@ -23,6 +24,7 @@ module Share.Postgres.NameLookups.Types
where

import Control.Lens hiding (from)
import Data.Foldable qualified as Foldable
import Data.List.Extra qualified as List
import Data.List.NonEmpty.Extra qualified as NonEmpty
import Data.Text qualified as Text
Expand All @@ -34,6 +36,7 @@ import Share.Prelude
import U.Codebase.Referent (ConstructorType)
import Unison.Name (Name)
import Unison.Name qualified as Name
import Unison.NameSegment qualified as NameSegment
import Unison.NameSegment.Internal (NameSegment (..))

-- | Proof that we've checked that a given name lookup exists before we try to use it.
Expand Down Expand Up @@ -124,6 +127,11 @@ type NamespaceText = Text
pathSegmentsToText :: PathSegments -> Text
pathSegmentsToText (PathSegments txt) = Text.intercalate "." txt

-- >>> nameToPathSegments (Name.fromSegments (NameSegment "base" :| [NameSegment "data", NameSegment "List"]))
-- PathSegments ["base","data","List"]
nameToPathSegments :: Name -> PathSegments
nameToPathSegments name = (PathSegments . Foldable.toList . fmap NameSegment.toUnescapedText $ Name.segments name)

-- |
-- >>> textToPathSegments "base.data.List"
-- PathSegments ["base","data","List"]
Expand Down
7 changes: 7 additions & 0 deletions src/Unison/Server/Share/Definitions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Share.Postgres qualified as PG
import Share.Postgres.Causal.Queries qualified as CausalQ
import Share.Postgres.IDs (CausalId)
import Share.Postgres.NameLookups.Ops qualified as NameLookupOps
import Share.Postgres.NameLookups.Types qualified as NL
import Share.Prelude
import Share.Utils.Caching.JSON qualified as Caching
import Unison.Codebase.Editor.DisplayObject (DisplayObject)
Expand Down Expand Up @@ -112,6 +113,10 @@ definitionForHQName perspective rootCausalId renderWidth suffixifyBindings rt pe
let docResults :: Name -> Codebase.CodebaseM e [(HashQualifiedName, UnisonHash, Doc.Doc)]
docResults name = do
Debug.debugM Debug.Server "definitionForHQName: looking up docs for name" name
-- We need to re-lookup the names perspective here because the name we've found
-- may now be in a lib.
namesPerspective <- NameLookupOps.namesPerspectiveForRootAndPath rootBranchNamespaceHashId (NL.nameToPathSegments name)
let nameSearch = PGNameSearch.nameSearchForPerspective namesPerspective
docRefs <- Docs.docsForDefinitionName nameSearch name
Debug.debugM Debug.Server "definitionForHQName: Found these docs" docRefs
renderDocRefs ppedBuilder width rt docRefs
Expand All @@ -122,12 +127,14 @@ definitionForHQName perspective rootCausalId renderWidth suffixifyBindings rt pe
typeDefinitions <-
ifor (Backend.typesToSyntaxOf suffixifyBindings width termAndTypePPED (Map.asList_ . traversed) types) \ref tp -> do
let hqTypeName = PPE.typeNameOrHashOnly fqnTermAndTypePPE ref
Debug.debugM Debug.Temp "definitionForHQName: hqTypeName " (ref, hqTypeName)
docs <- maybe (pure []) docResults (HQ.toName hqTypeName)
lift $ Backend.mkTypeDefinition termAndTypePPED width ref docs tp
termDefinitions <-
ifor (Backend.termsToSyntaxOf suffixifyBindings width termAndTypePPED (Map.asList_ . traversed) terms) \reference trm -> do
let referent = Referent.Ref reference
let hqTermName = PPE.termNameOrHashOnly fqnTermAndTypePPE referent
Debug.debugM Debug.Temp "definitionForHQName: hqTermName " (reference, hqTermName)
docs <- maybe (pure []) docResults (HQ.toName hqTermName)
Backend.mkTermDefinition termAndTypePPED width reference docs trm
let renderedDisplayTerms = Map.mapKeys Reference.toText termDefinitions
Expand Down
42 changes: 35 additions & 7 deletions transcripts/share-apis/contribution-diffs/contribution-diff.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -197,7 +201,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -295,7 +303,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -397,7 +409,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -494,7 +510,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
}
]
},
Expand Down Expand Up @@ -617,7 +637,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -704,7 +728,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down
42 changes: 35 additions & 7 deletions transcripts/share-apis/contribution-diffs/namespace-diff.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -197,7 +201,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -295,7 +303,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -397,7 +409,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -494,7 +510,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
}
]
},
Expand Down Expand Up @@ -617,7 +637,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down Expand Up @@ -704,7 +728,11 @@
},
{
"annotation": null,
"segment": " "
"segment": "\n"
},
{
"annotation": null,
"segment": " "
},
{
"annotation": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Add a change to a contributor branch, based on the main branch.

``` unison
``` ucm :hide
scratch/main> clone @transcripts/merge/main

@transcripts/merge/main> branch @test/fast-forward-feature
```

``` unison :hide
term = "feature"
```

Expand All @@ -9,9 +15,6 @@ Push the feature branch.
``` ucm
@transcripts/merge/@test/fast-forward-feature> update

Okay, I'm searching the branch for code that needs to be
updated...

Done.

@transcripts/merge/@test/fast-forward-feature> push @transcripts/merge/@test/fast-forward-feature
Expand All @@ -22,5 +25,4 @@ Push the feature branch.
on http://localhost:5424

View it here: @transcripts/merge/@test/fast-forward-feature on http://localhost:5424

```
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
``` ucm :hide
scratch/main> project.create-empty merge
```

Create a main branch.

``` unison
``` unison :hide
term = "start"
```

Expand All @@ -9,9 +13,6 @@ Push it.
``` ucm
merge/main> update

Okay, I'm searching the branch for code that needs to be
updated...

Done.

merge/main> push @transcripts/merge/main
Expand All @@ -21,5 +22,4 @@ merge/main> push @transcripts/merge/main
I just created @transcripts/merge on http://localhost:5424

View it here: @transcripts/merge/main on http://localhost:5424

```
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ scratch/main> clone @transcripts/merge/main

term : ##Text
term = "feature"

```
Loading
Loading