urbit/pkg/arvo
Philip Monk 76b917f426
dojo: add tab completion
This is initial support for type-aware tab completion.  When you hit tab, it tries to complete the word you're in the middle of using a face or arm in the subject at that point in the code.  It also shows all possible matches and their associated types.  It's nearly instantaneous.  Notes:

- It advances to the longest common prefix, so if you hit tab on `ab` and the only possible results are `abcde` and `abcdz`, then it'll write `abcd` and print both out (with their types).

- If there are fewer than ten matches, it prints the type along with the face.  Printing types is too slow to use all the time, but with 10 it's essentially instantaneous.

- The match closest in the subject to you (i.e. smallest axis number) is displayed lowest (closest to your focus).

Examples below, where `<TAB>` represents me hitting tab while my cursor is at that position (the line with the `<TAB>` is not preserved in the actual output).

```
~zod:dojo> eth<TAB>
-----
ethereum        #t/<11.qcl {<3.ltb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141> <21.yeb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141>}>
ethereum-types  #t/<3.ltb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141>
~zod:dojo> ethereum
~zod:dojo> |=  zong=@ud  z<TAB>
-----
zing  #t/<1.dqs {* <126.xjf 41.mac 1.ane $141>}>
zap   #t/<1.iot {tub/{p/{p/@ud q/@ud} q/""} <1.rff {daf/@t <247.ows 51.mvt 126.xjf 41.mac 1.ane $141>}>}>
zuse  #t/$309
zong  #t/@ud
~zod:dojo> |=  zong=@ud  zo<TAB>
-----
zong  #t/@ud
~zod:dojo> |=  zong=@ud  zong
~zod:dojo> <TAB>
hoon-version
trel
quip
pole
unit
qual
lone
... about 600 more lines ...
unity
html
zuse
eny
now
our
~zod:dojo>
```

Functionally, this is in a state where I'd be comfortable shipping it.  It doesn't interfere with anything if you don't press tab, and it's perfectly OTA-able.  I do think its output is a little verbose, but that can be tuned over time as people try it and determine what feels good in practice.

Additional notes:

- There are plenty of similar systems for other languages, but my most direct inspiration is Idris's editor tools.  This is implemented for the dojo, but I actually want it in my editor, which is why the meat is all defind in a library.  I've only tested on dojo one-liners, so I don't know the performance on large blocks of code.

- The default type printer isn't great for this use case.  In particular,
	- Cores should not print anything about their context
  - The `#t/` should go away
  - If it looks like a gate, we should print its return value
  - Maybe special handling for molds, but if the above is done, then for example `bone` is  `* -> @ud`.

- The worst part about our wing ordering is that it really screws up tab completion.  You want to do `point.owner-address` instead of `owner-address.point` because that lets you type `point.ow<TAB>`.  I weakly prefer reading it how we do it now, but it's really not great.  You could do an (dojo-specific?) alternate syntax of `point;owner-address`; this is a simple transformation.

- Regardless of the above, this should handle the case where we're in the middle of defining a wing; it doesn't right now.

- When a variable is shadowed, we show both of them.  We should probably show the shadowed one with a `^`.

- We probably shouldn't print out hundreds of results.  Maybe just the closest 50 with ellipses.

- This gets you any face in your subject, regardless of whether its type is reasonable.  We could limit that some by copying the `gol` logic in mint, so that if the pseudo-backward-inference engine happens to know what type it should be, you can filter the tab results according to if they nest in that type.  This would be "strongly type-aware".
2019-10-30 23:19:25 -07:00
..
.travis Add 'pkg/arvo/' from commit 'c20e2a185f131ff3f5d3961829bd7a3fe0f227f8' 2019-06-28 12:48:05 +08:00
app dojo: add tab completion 2019-10-30 23:19:25 -07:00
gen azimuth-tracker: fix |watch generator 2019-10-17 10:37:09 -07:00
lib dojo: add tab completion 2019-10-30 23:19:25 -07:00
mar apps: added permission hook and chat-view %join action 2019-10-11 14:09:30 -07:00
ren updated publish files 2019-07-18 15:34:42 -07:00
sur dojo: add tab completion 2019-10-30 23:19:25 -07:00
sys eyre: fix wire=path terminology 2019-10-25 16:04:29 -07:00
tests tests: disable %ames test-send 2019-10-15 23:23:57 +04:00
.gitignore Add 'pkg/arvo/' from commit 'c20e2a185f131ff3f5d3961829bd7a3fe0f227f8' 2019-06-28 12:48:05 +08:00
.travis.yml Add 'pkg/arvo/' from commit 'c20e2a185f131ff3f5d3961829bd7a3fe0f227f8' 2019-06-28 12:48:05 +08:00
LICENSE.txt Add 'pkg/arvo/' from commit 'c20e2a185f131ff3f5d3961829bd7a3fe0f227f8' 2019-06-28 12:48:05 +08:00
README.md meta: update contributing section in arvo readme [ci skip] 2019-10-03 14:39:14 +04:00
TESTING.udon Moved testing documentation out of tests folder so as to pass tests~ 2019-07-05 16:48:40 -07:00

Arvo

A clean-slate operating system.

Usage

To run Arvo, you'll need Urbit. To install Urbit and run Arvo please follow the instructions in the getting started docs. You'll be on the live network in a few minutes.

If you're doing development on Arvo, keep reading.

Documentation

Find Arvo's documentation on urbit.org.

Development

To boot a fake ship from your development files, run urbit with the following arguments:

urbit -F zod -A /path/to/arvo -c fakezod

Mount Arvo's filesystem allows you to update its contents through Unix. To do so, run |mount in dojo. It is most common to |mount /=home=.

To create a custom pill (bootstrapping object) from the files loaded into the home desk, run .my/pill +solid. Your pill will appear in /path/to/fakezod/.urb/put/my.pill.

To boot a fake ship with a custom pill, use the -B flag:

urbit -F zod -A /path/to/arvo -B /path/to.pill -c fakezod

To run all tests in /tests, run +test in dojo. +test /some/path would only run all tests in /tests/some/path.

Maintainers

Most parts of Arvo have dedicated maintainers.

  • /sys/hoon: @pilfer-pandex (~pilfer-pandex)
  • /sys/zuse: @pilfer-pandex (~pilfer-pandex)
  • /sys/arvo: @jtobin (~nidsut-tomdun)
  • /sys/vane/ames: @belisarius222 (~rovnys-ricfer) & @joemfb (~master-morzod)
  • /sys/vane/behn: @belisarius222 (~rovnys-ricfer)
  • /sys/vane/clay: @philipcmonk (~wicdev-wisryt)
  • /sys/vane/dill: @bernardodelaplaz (~rigdyn-sondur)
  • /sys/vane/eyre: @eglaysher (~littel-ponnys)
  • /sys/vane/ford: @belisarius222 (~rovnys-ricfer) & @eglaysher (~littel-ponnys)
  • /sys/vane/gall: @jtobin (~nidsut-tomdun)
  • /sys/vane/jael: @fang- (~palfun-foslup) & @joemfb (~master-morzod)
  • /app/acme: @joemfb (~master-morzod)
  • /app/dns: @joemfb (~master-morzod)
  • /app/hall: @fang- (~palfun-foslup)
  • /app/talk: @fang- (~palfun-foslup)
  • /app/aqua: @philipcmonk (~wicdev-wisryt)
  • /lib/test: @eglaysher (~littel-ponnys)

Contributing

Contributions of any form are more than welcome! Please take a look at our contributing guidelines for details on our git practices, coding styles, how we manage issues, and so on.

You might also be interested in: