[RFC]: add support for signature argument hints in the REPL
- 主要语言
- JavaScript
- 星标
- 6k
- 派生
- 1.3k
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 611
描述
### Description
This RFC proposes adding support for signature argument hints in the REPL. The idea is to extend the preview completion functionality introduced in https://github.com/stdlib-js/stdlib/pull/1832 to display function and method signatures (i.e., parameter lists), similar to what modern IDEs support when leveraging TypeScript declarations and JSDoc comments.
Once a user types `foo(`, modern IDEs can read, e.g., TypeScript overloads to display parameter hints (e.g., `foo(<|> beep: string, boop?: number )`, where `<|>` indicates the cursor. In this RFC, the proposal is that we should add similar support to the REPL where everything after the cursor would be greyed out text, similar to preview completions introduced in https://github.com/stdlib-js/stdlib/pull/1832. However, one key difference is that the signatures are purely to serve as hints; once a user begins typing a literal or identifier for a parameter, the hint for that parameter should disappear and normal TAB completion should be possible. After a user has finished and typed `,` in the example above, we'd display another hint for the second parameter.
We already have a database of signatures, as derived from TypeScript declarations (see https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/repl/signature). Currently, you can only see these signatures using the `info` command. In the REPL,
```
In [1]: info( typedarray )
```
will display a list of overloads and one line descriptions. We could potentially leverage the database to support signature argument hints.
### Related Issues
- https://github.com/stdlib-js/stdlib/pull/1832
### Questions
No.
### Other
No.
### 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 reading the signature database under lib/node_modules/@stdlib/repl/signature and the existing info command, then review the preview completion work in PR 1832. Done means the REPL uses available signatures to show context-sensitive argument hints, hides each hint as its argument is typed, and advances to the next hint after a comma.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript
- 领域
- cli, developer-experience
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100