Commit Graph

41 Commits

Author SHA1 Message Date
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
Logan Allen
7f0ab1b8ab permission-hook: style improvement 2019-10-12 18:58:20 -07:00
Logan Allen
b12e305c9c apps: added permission hook and chat-view %join action 2019-10-11 14:09:30 -07:00
Logan Allen
fbbb3830b2 chat: style fixes, removed some redirect bugs from chat 2019-10-08 10:11:18 -07:00
Logan Allen
79903ff9f5 chat: changed wire format and quitting subscription properly on ban 2019-10-07 17:35:48 -07:00
Logan Allen
39a5017254 chat: added old @ messages, now called %me messages 2019-10-03 13:33:07 -07:00
Logan Allen
f9377536fb app: Added chat store, hook, marks, and view. 2019-10-01 10:18:36 -07:00
Logan Allen
4b01718d76 apps: added group/permission stores, hooks, marks 2019-09-30 14:46:07 -07:00
Logan Allen
203be550fe tiebout: removed since it's unused 2019-09-26 14:43:50 -07:00
Jared Tobin
1076663018
Merge branch 'philip/jael-fix' 2019-08-24 08:31:25 -02:30
Philip Monk
ec9eedd50f
ph: clean up card structures 2019-08-22 15:33:52 -07:00
Isaac Visintainer
b24cdf317b added import and export arms to publish 2019-08-21 13:22:38 -07:00
Isaac Visintainer
5a2d0e62ca fixed unread notification logic and added unread badges to post previews 2019-08-13 15:39:37 -07:00
Jared Tobin
14b6816300
Merge pull request #1606 from urbit/modulo-lib-surs
Make modulo follow lib-sur conventions
2019-08-12 19:52:51 -07:00
Philip Monk
6349fc85ee
add +scry to lib/stdio 2019-08-12 13:50:14 -07:00
Fang
a59149bc23
Move :publish app state type into app itself 2019-08-11 12:21:39 -07:00
Fang
2726eff1d4
Move :chat types into /sur 2019-08-11 11:59:59 -07:00
Fang
cac4b2b70f
Move :launch types into /sur 2019-08-09 14:54:52 -07:00
Philip Monk
6212422015
kale -> jael 2019-08-06 15:42:37 -07:00
Philip Monk
0adc83ecf6
get pills from aqua 2019-08-05 17:44:52 -07:00
Philip Monk
21e4baa2ed
Merge remote-tracking branch 'origin/master' into philip/kale 2019-08-05 13:02:31 -07:00
Elliot Glaysher
63e72122d8
Merge pull request #1358 from urbit/lens-export
Add --import and --export
2019-08-01 13:18:12 -07:00
Philip Monk
54a3031397
add keys to sponsor in preboot validation 2019-08-01 11:14:36 -07:00
Philip Monk
578d14bfea
implement kale hierarchy 2019-07-30 16:26:47 -07:00
Philip Monk
e39a2c0467
all breach tests pass 2019-07-29 15:09:08 -07:00
Philip Monk
a47ef9ac77
wip 2019-07-26 20:45:45 -07:00
Elliot Glaysher
d9a0cb4c6b
Merge branch 'master' into lens-export 2019-07-23 13:43:42 -07:00
Philip Monk
93a4160a35
Merge remote-tracking branch 'origin/v0.8.0.rc' into philip/kale 2019-07-22 10:39:15 -07:00
Philip Monk
994472ece1
azimuth-tracker sends to kale 2019-07-18 17:08:01 -07:00
Isaac Visintainer
b7aad187e6 updated publish files 2019-07-18 15:34:42 -07:00
Philip Monk
408b72b68e
fixed up kale 2019-07-18 15:26:15 -07:00
Elliot Glaysher
a8c2c06db9 Now with a working --import. 2019-07-16 13:52:42 -07:00
Elliot Glaysher
5082ce6b98 Part 1: Add the export action and get that into herb. 2019-07-15 15:18:28 -07:00
Isaac Visintainer
500b3a7a60 80 cols 2019-07-11 15:20:29 -07:00
Isaac Visintainer
a60d8cdbfc changed name of app to be consistent 2019-07-11 15:07:05 -07:00
Isaac Visintainer
cfebabe7c7 updated publish files 2019-07-11 11:32:30 -07:00
Logan Allen
9d16d94d54 Remove recoverable-error 2019-07-05 16:43:29 -07:00
Logan Allen
f43a5e1b5d Removed old references to setting up fora, streams, collection, web folder, landscape, and plan 2019-07-05 15:05:09 -07:00
Joe Bryan
27da0d61d8 renames +http-client interface core to +iris 2019-07-03 23:52:22 -07:00
Joe Bryan
e0f17b0ff1 moves +http-server interface core into +eyre 2019-07-03 23:29:13 -07:00
Jared Tobin
b3901ab42f Add 'pkg/arvo/' from commit 'c20e2a185f131ff3f5d3961829bd7a3fe0f227f8'
git-subtree-dir: pkg/arvo
git-subtree-mainline: 9c8f40bf6c
git-subtree-split: c20e2a185f
2019-06-28 12:48:05 +08:00