2022-08-17 00:01:46 +03:00
|
|
|
# Tab Completion
|
|
|
|
|
|
|
|
Test that tab completion works as expected.
|
|
|
|
|
|
|
|
## Tab Complete Command Names
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete vi
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
view
|
2022-08-17 21:23:46 +03:00
|
|
|
view.global
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete delete.
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2023-04-05 17:47:35 +03:00
|
|
|
delete.branch
|
2022-08-17 00:01:46 +03:00
|
|
|
delete.namespace
|
|
|
|
delete.namespace.force
|
2023-05-16 19:58:38 +03:00
|
|
|
delete.project
|
2022-08-17 00:01:46 +03:00
|
|
|
delete.term
|
2022-12-05 21:23:47 +03:00
|
|
|
delete.term.verbose
|
2022-08-17 00:01:46 +03:00
|
|
|
delete.type
|
2022-12-05 21:23:47 +03:00
|
|
|
delete.type.verbose
|
|
|
|
delete.verbose
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
## Tab complete terms & types
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2022-08-17 00:01:46 +03:00
|
|
|
subnamespace.someName = 1
|
|
|
|
subnamespace.someOtherName = 2
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace2.thing = 3
|
|
|
|
othernamespace.someName = 4
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
unique type subnamespace.AType = A | B
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2022-08-17 00:01:46 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
2024-01-04 11:42:12 +03:00
|
|
|
type subnamespace.AType
|
2022-08-17 00:01:46 +03:00
|
|
|
othernamespace.someName : ##Nat
|
|
|
|
subnamespace.someName : ##Nat
|
|
|
|
subnamespace.someOtherName : ##Nat
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace2.thing : ##Nat
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-08-17 00:01:46 +03:00
|
|
|
-- Should tab complete namespaces since they may contain terms/types
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view sub
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
subnamespace.
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace2.
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2022-09-10 18:53:05 +03:00
|
|
|
-- Should not complete things from child namespaces of the current query if there are other completions at this level
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view subnamespace
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace.
|
|
|
|
subnamespace2.
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2022-09-10 18:53:05 +03:00
|
|
|
-- Should complete things from child namespaces of the current query if it's dot-suffixed
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view subnamespace.
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
* subnamespace.AType
|
|
|
|
subnamespace.AType.
|
|
|
|
* subnamespace.someName
|
|
|
|
* subnamespace.someOtherName
|
|
|
|
|
2022-09-10 18:53:05 +03:00
|
|
|
-- Should complete things from child namespaces of the current query if there are no more completions at this level.
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view subnamespace2
|
2022-09-10 18:53:05 +03:00
|
|
|
|
|
|
|
subnamespace2.
|
|
|
|
* subnamespace2.thing
|
|
|
|
|
2022-08-17 00:01:46 +03:00
|
|
|
-- Should prefix-filter by query suffix
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view subnamespace.some
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
* subnamespace.someName
|
|
|
|
* subnamespace.someOtherName
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete view subnamespace.someOther
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
* subnamespace.someOtherName
|
|
|
|
|
2024-06-26 21:55:35 +03:00
|
|
|
```
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2024-06-26 21:55:35 +03:00
|
|
|
absolute.term = "absolute"
|
|
|
|
```
|
2024-06-12 01:22:09 +03:00
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-07-02 19:48:07 +03:00
|
|
|
scratch/main> add
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2024-06-26 21:55:35 +03:00
|
|
|
⍟ I've added these definitions:
|
2024-06-12 01:22:09 +03:00
|
|
|
|
2024-06-26 21:55:35 +03:00
|
|
|
absolute.term : ##Text
|
|
|
|
|
|
|
|
-- Should tab complete absolute names
|
2024-07-02 19:48:07 +03:00
|
|
|
scratch/main> debug.tab-complete view .absolute.te
|
2024-06-26 21:55:35 +03:00
|
|
|
|
|
|
|
* .absolute.term
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
## Tab complete namespaces
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2022-08-17 00:01:46 +03:00
|
|
|
-- Should tab complete namespaces
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete find-in sub
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
subnamespace
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace2
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete find-in subnamespace
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
subnamespace
|
2022-09-10 18:53:05 +03:00
|
|
|
subnamespace2
|
2022-08-17 00:01:46 +03:00
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete find-in subnamespace.
|
2022-08-17 00:01:46 +03:00
|
|
|
|
|
|
|
subnamespace.AType
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete io.test sub
|
2022-09-15 17:56:14 +03:00
|
|
|
|
|
|
|
subnamespace.
|
|
|
|
subnamespace2.
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete io.test subnamespace
|
2022-09-15 17:56:14 +03:00
|
|
|
|
|
|
|
subnamespace.
|
|
|
|
subnamespace2.
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete io.test subnamespace.
|
2022-09-15 17:56:14 +03:00
|
|
|
|
|
|
|
subnamespace.AType.
|
|
|
|
* subnamespace.someName
|
|
|
|
* subnamespace.someOtherName
|
|
|
|
|
2023-10-09 22:59:01 +03:00
|
|
|
```
|
|
|
|
Tab Complete Delete Subcommands
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2023-10-09 22:59:01 +03:00
|
|
|
unique type Foo = A | B
|
|
|
|
add : a -> a
|
|
|
|
add b = b
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-10-09 22:59:01 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2023-10-09 22:59:01 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
2024-01-04 11:42:12 +03:00
|
|
|
type Foo
|
2023-10-09 22:59:01 +03:00
|
|
|
add : a -> a
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> update.old
|
2023-10-09 22:59:01 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
2024-01-04 11:42:12 +03:00
|
|
|
type Foo
|
2023-10-09 22:59:01 +03:00
|
|
|
add : a -> a
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete delete.type Foo
|
2023-10-09 22:59:01 +03:00
|
|
|
|
|
|
|
* Foo
|
|
|
|
Foo.
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete delete.term add
|
2023-10-09 22:59:01 +03:00
|
|
|
|
2023-10-10 09:19:09 +03:00
|
|
|
* add
|
2023-10-09 22:59:01 +03:00
|
|
|
|
2022-08-17 00:01:46 +03:00
|
|
|
```
|
2023-12-15 02:03:08 +03:00
|
|
|
## Tab complete projects and branches
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-12-15 02:03:08 +03:00
|
|
|
myproject/main> branch mybranch
|
|
|
|
|
|
|
|
Done. I've created the mybranch branch based off of main.
|
|
|
|
|
2024-04-24 19:29:15 +03:00
|
|
|
Tip: To merge your work back into the main branch, first
|
2024-05-01 20:18:46 +03:00
|
|
|
`switch /main` then `merge /mybranch`.
|
2023-12-15 02:03:08 +03:00
|
|
|
|
|
|
|
myproject/main> debug.tab-complete branch.delete /mybr
|
|
|
|
|
|
|
|
/mybranch
|
|
|
|
|
|
|
|
myproject/main> debug.tab-complete project.rename my
|
|
|
|
|
|
|
|
myproject
|
|
|
|
|
|
|
|
```
|
|
|
|
Commands which complete namespaces OR branches should list both
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2023-12-15 02:03:08 +03:00
|
|
|
mybranchsubnamespace.term = 1
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-12-15 02:03:08 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2023-12-15 02:03:08 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
|
|
|
mybranchsubnamespace.term : ##Nat
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-12-15 02:03:08 +03:00
|
|
|
myproject/main> add
|
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
|
|
|
mybranchsubnamespace.term : ##Nat
|
|
|
|
|
|
|
|
myproject/main> debug.tab-complete merge mybr
|
|
|
|
|
2024-05-13 18:34:01 +03:00
|
|
|
/mybranch
|
2023-12-15 02:03:08 +03:00
|
|
|
|
|
|
|
```
|