File tree Expand file tree Collapse file tree 2 files changed +60
-3
lines changed
unison-share-api/src/Unison/Server/Local/Endpoints
unison-src/transcripts/idempotent Expand file tree Collapse file tree 2 files changed +60
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ import Unison.Codebase.Branch qualified as Branch
32
32
import Unison.Codebase.Branch.Names qualified as Branch
33
33
import Unison.Codebase.Path qualified as Path
34
34
import Unison.Codebase.ProjectPath
35
- import Unison.Debug qualified as Debug
36
35
import Unison.HashQualified qualified as HQ
37
36
import Unison.Name (Name )
38
37
import Unison.NamesWithHistory (SearchType (.. ))
@@ -159,15 +158,13 @@ getDefinitionDependentsEndpoint _rt codebase projectAndBranch hqn mayWidth = do
159
158
let nameSearch = makeNameSearch hqLength namesWithoutLibdeps
160
159
QueryResult {hits} <- lift $ Backend. hqNameQuery codebase nameSearch ExactName [hqn]
161
160
162
- Debug. debugM Debug. Temp " hits" hits
163
161
let defs =
164
162
hits & foldMap \ case
165
163
Tp TypeResult {reference} -> Defns {terms = Set. empty, types = (Set. singleton reference)}
166
164
Tm TermResult {referent} -> Defns {terms = (Set. singleton referent), types = Set. empty}
167
165
168
166
dependents <- lift $ Codebase. dependentsWithinBranchScope rootBranch0WithoutLibdeps defs
169
167
pure (dependents, namesWithoutLibdeps)
170
- Debug. debugM Debug. Temp " dependents" dependents
171
168
172
169
let pped = PPED. makePPED (PPE. hqNamer 10 namesWithoutLibdeps) PPE. dontSuffixify
173
170
definitionSearchResults <-
Original file line number Diff line number Diff line change @@ -167,6 +167,8 @@ RESPONSE:
167
167
168
168
```
169
169
170
+ Has no dependents:
171
+
170
172
``` api
171
173
GET /api/projects/scratch/branches/main/getDefinitionDependents?name=mySum
172
174
RESPONSE:
@@ -175,3 +177,61 @@ RESPONSE:
175
177
}
176
178
177
179
```
180
+
181
+ Can also get dependents by a hash-only:
182
+
183
+ ``` api
184
+ GET /api/projects/scratch/branches/main/getDefinitionDependents?name=@0qbc2dfom7
185
+ RESPONSE:
186
+ {
187
+ "results": [
188
+ {
189
+ "branchRef": "main",
190
+ "definition": {
191
+ "displayName": "myVal",
192
+ "hash": "#88n7vpiqu9qhuj8v444iq3h7v93qvi7kei7dmmjojg3kc52v1aisg435t9bfedqakhk5fv8hu15daf379c7ovrfci9q627s6e3r7h1g",
193
+ "summary": {
194
+ "contents": [
195
+ {
196
+ "annotation": {
197
+ "contents": "#0qbc2dfom7m4pputtdojo849g2mp5kkr00kvsvjktb07tcmo1jql53bg73bqiib35vja4a7059rcet0raf7jsh4d8vg5582ibinpqj8",
198
+ "tag": "TypeReference"
199
+ },
200
+ "segment": "MyType"
201
+ }
202
+ ],
203
+ "tag": "UserObject"
204
+ },
205
+ "tag": "Plain"
206
+ },
207
+ "fqn": "myVal",
208
+ "kind": "term",
209
+ "projectRef": "scratch"
210
+ },
211
+ {
212
+ "branchRef": "main",
213
+ "definition": {
214
+ "displayName": "myCase",
215
+ "hash": "#le6cur61p625qb7qfsaq836ln4l20u3ecngthot7io4p762ijb5t5hiv0c59eab9b8lktjp8l0j70r53ci43s89hjjik6hfsvkbjv28",
216
+ "summary": {
217
+ "contents": [
218
+ {
219
+ "annotation": {
220
+ "contents": "##Nat",
221
+ "tag": "TypeReference"
222
+ },
223
+ "segment": "builtin.Nat"
224
+ }
225
+ ],
226
+ "tag": "UserObject"
227
+ },
228
+ "tag": "Plain"
229
+ },
230
+ "fqn": "myCase",
231
+ "kind": "term",
232
+ "projectRef": "scratch"
233
+ }
234
+ ]
235
+ }
236
+
237
+ ```
You can’t perform that action at this time.
0 commit comments