stdlib-js / stdlib-js/stdlib

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

未关闭
#2,074 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
difficulty: 5 Enhancement JavaScript Needs Discussion priority: Normal REPL RFC
主要语言
JavaScript
星标
6k
派生
1.3k
平均合并
1 天 3 小时
30 天内合并 PR
611

描述

### 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:`.

贡献指南

打开贡献指南

调研方向

Start by reviewing the REPL signature database in lib/node_modules/@stdlib/repl/signature and the dependent issue #2073. Compare the proposed eager evaluation approach with static return-type information and the related completion previews in issue #1775. Done means the RFC's design is resolved enough to define implementation work for post-execution completion and previews.

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
cli
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。