unison/unison-src/transcripts/lsp-name-completion.md
Greg Pfeil 75c228f4e1
Use CommonMark-compatible info strings everywhere
The bulk of this updates transcripts to put spaces around the language
name in code blocks. E.g.,
```` markdown
```ucm:hide
````
becomes
```` markdown
``` ucm :hide
````

This corresponds to
https://share.unison-lang.org/@unison/website/contributions/11, which
updates the docs in the same way.

This is effectively a fix for #5214, but that issue also has good recommendations for future changes to info strings, so
I don’t know that it should be closed.
2024-10-08 14:23:34 -06:00

36 lines
1.1 KiB
Markdown

``` ucm :hide
scratch/main> builtins.merge lib.builtins
```
``` unison :hide
foldMap = "top-level"
nested.deeply.foldMap = "nested"
lib.base.foldMap = "lib"
lib.dep.lib.transitive.foldMap = "transitive-lib"
-- A deeply nested definition with the same hash as the top level one.
-- This should not be included in the completion results if a better name with the same hash IS included.
lib.dep.lib.transitive_same_hash.foldMap = "top-level"
foldMapWith = "partial match"
other = "other"
```
``` ucm :hide
scratch/main> add
```
Completion should find all the `foldMap` definitions in the codebase,
sorted by number of name segments, shortest first.
Individual LSP clients may still handle sorting differently, e.g. doing a fuzzy match over returned results, or
prioritizing exact matches over partial matches. We don't have any control over that.
``` ucm
scratch/main> debug.lsp-name-completion foldMap
```
Should still find the term which has a matching hash to a better name if the better name doesn't match.
``` ucm
scratch/main> debug.lsp-name-completion transitive_same_hash.foldMap
```