2022-08-17 00:01:46 +03:00
|
|
|
# Tab Completion
|
|
|
|
|
|
|
|
Test that tab completion works as expected.
|
|
|
|
|
|
|
|
## Tab Complete Command Names
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete vi
|
|
|
|
scratch/main> debug.tab-complete delete.
|
2022-08-17 00:01:46 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Tab complete terms & types
|
|
|
|
|
|
|
|
```unison
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm:hide
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2022-08-17 00:01:46 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
|
|
|
-- 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-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-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-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-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
|
|
|
|
scratch/main> debug.tab-complete view subnamespace.someOther
|
2024-06-26 21:55:35 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
```unison:hide
|
|
|
|
absolute.term = "absolute"
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-07-02 19:48:07 +03:00
|
|
|
scratch/main> add
|
2022-08-17 00:01:46 +03:00
|
|
|
-- Should tab complete absolute names
|
2024-07-02 19:48:07 +03:00
|
|
|
scratch/main> debug.tab-complete view .absolute.te
|
2022-08-17 00:01:46 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Tab complete namespaces
|
|
|
|
|
|
|
|
```ucm
|
|
|
|
-- Should tab complete namespaces
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> debug.tab-complete find-in sub
|
|
|
|
scratch/main> debug.tab-complete find-in subnamespace
|
|
|
|
scratch/main> debug.tab-complete find-in subnamespace.
|
|
|
|
scratch/main> debug.tab-complete io.test sub
|
|
|
|
scratch/main> debug.tab-complete io.test subnamespace
|
|
|
|
scratch/main> debug.tab-complete io.test subnamespace.
|
2022-08-17 00:01:46 +03:00
|
|
|
```
|
2023-10-09 22:59:01 +03:00
|
|
|
|
|
|
|
Tab Complete Delete Subcommands
|
|
|
|
|
|
|
|
```unison
|
|
|
|
unique type Foo = A | B
|
|
|
|
add : a -> a
|
|
|
|
add b = b
|
|
|
|
```
|
|
|
|
|
|
|
|
```ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> update.old
|
|
|
|
scratch/main> debug.tab-complete delete.type Foo
|
|
|
|
scratch/main> debug.tab-complete delete.term add
|
2023-10-09 22:59:01 +03:00
|
|
|
```
|
2023-12-15 02:03:08 +03:00
|
|
|
|
|
|
|
## Tab complete projects and branches
|
|
|
|
|
|
|
|
```ucm
|
|
|
|
myproject/main> branch mybranch
|
|
|
|
myproject/main> debug.tab-complete branch.delete /mybr
|
|
|
|
myproject/main> debug.tab-complete project.rename my
|
|
|
|
```
|
|
|
|
|
|
|
|
Commands which complete namespaces OR branches should list both
|
|
|
|
|
|
|
|
```unison
|
|
|
|
mybranchsubnamespace.term = 1
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```ucm
|
|
|
|
myproject/main> add
|
|
|
|
myproject/main> debug.tab-complete merge mybr
|
|
|
|
```
|