An operating function (Prototype)
Go to file
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
bin Merge branch 'philip/jael-ames-full' (#1882) 2019-10-25 14:05:01 +08:00
doc/spec Misc cleanup blocking CC-Release. (#1249) 2019-04-24 17:27:27 -07:00
extras Misc cleanup blocking CC-Release. (#1249) 2019-04-24 17:27:27 -07:00
nix build: add Ropsten derivations for arvo and pills 2019-10-24 10:03:52 +08:00
pkg dojo: add tab completion 2019-10-30 23:19:25 -07:00
sh build: add ropsten-pills target to Makefile 2019-10-24 10:03:52 +08:00
.gitattributes Nix Build + Monorepo Structure (#1196) 2019-03-04 16:43:53 -08:00
.gitignore automatically rename minified files 2019-07-24 15:13:21 -07:00
.mailmap mailmap: add .mailmap file [ci skip] 2019-10-07 16:54:31 +04:00
.travis.yml only update cachix if credentials are available 2019-07-15 14:46:36 -07:00
CONTRIBUTING.md contributing: fix awkward language [ci skip] 2019-10-06 19:03:26 +04:00
default.nix Nix Build + Monorepo Structure (#1196) 2019-03-04 16:43:53 -08:00
Makefile build: add ropsten-pills target to Makefile 2019-10-24 10:03:52 +08:00
README.md readme: point arvo URL at subtree [ci skip] 2019-09-20 12:16:50 -02:30

Urbit

A personal server operating function.

The Urbit address space, Azimuth, is now live on the Ethereum blockchain. You can find it at 0x223c067f8cf28ae173ee5cafea60ca44c335fecb or azimuth.eth. Owners of Azimuth points (galaxies, stars, or planets) can view or manage them using Bridge, and can also use them to boot Arvo, the Urbit OS.

Install

To install and run Urbit, please follow the instructions at urbit.org/docs/getting-started/. You'll be on the live network in a few minutes.

If you're interested in Urbit development, keep reading.

Development

Build Status

Urbit uses Nix to manage builds. On Linux and macOS you can install Nix via:

curl https://nixos.org/nix/install | sh

The Makefile in the project's root directory contains useful phony targets for building, installing, testing, and so on. You can use it to avoid dealing with Nix explicitly.

To build Urbit, for example, use:

make build

The test suite can similarly be run via a simple:

make test

Note that some of the Makefile targets need access to pills tracked via git LFS, so you'll also need to have those available locally:

git lfs install
git lfs pull

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: