stdlib-js / stdlib-js/stdlib

[RFC]: support auto-completion and completion previews after function executions in the REPL

Đang mở
#2,074 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
difficulty: 5 Enhancement JavaScript Needs Discussion priority: Normal REPL RFC
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### Description

This RFC proposes adding support for auto-completion and completion previews after function executions in the REPL. The idea is that, for side-effect commands, we could eagerly evaluate and support TAB completion and the display of potential completions. E.g., consider

```
In [1]: [ 'foo', 'bar', 'beep' ].sort().fil<|>
```

where `<|>` is the cursor. In this example, after eager evaluation, we know that `sort()` returns the input array and thus we should be able to auto-complete `filter`.

One possibility which may not rely on eager evaluation for implementing this RFC is to take advantage of take advantage of our signature database (see https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/repl/signature), where we statically know output values. If a function/method returns a value having a specific type, we can then auto-complete based on the known properties/methods of that type.

Eager evaluation, however, would allow for result previews of chained commands and would also the need to analyze complex static AST graphs.

### Related Issues

- Implementing this RFC is dependent on https://github.com/stdlib-js/stdlib/issues/2073.
- Completion previews: https://github.com/stdlib-js/stdlib/issues/1775

### Questions

No.

### Other

- https://developer.chrome.com/blog/new-in-devtools-68/#eagerevaluation

### Checklist

- [X] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with `RFC:`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.