stdlib-js / stdlib-js/stdlib

[RFC]: add a `search` API to the REPL

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

描述

### Description

This RFC proposes adding built-in support for searching within the stdlib REPL environment. Something along the lines of

```
In [1]: search( 'absolute value' )

```

While the REPL supports TAB completion, including the display of potential matches, one still has to know, more or less, where to find things, which can be difficult due to the use of namespaces (e.g., `base`, `base.strided`, `random`, etc).

In short, it can be hard to find the REPL function you want to use. This RFC proposes reducing that barrier by building in search capabilities to the REPL.

### Related Issues

No.

### Questions

- Should search be fuzzy? Probably. If someone types `'abolute value'`, we shouldn't return zero results because the user misspelled `absolute`.
- Prior art: https://github.com/farzher/fuzzysort
- What should be returned? We may want modes/flags that allow users to specify what they want to return. E.g., REPL aliases, package names, etc.

### Other

- We have some prior art for this in the project. Namely, for the API documentation website we use https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/search/pkg-index for generating the search index. We could potentially leverage that for building a similar idea, and may be beneficial to write our own TF-IDF package.
- As search would be built into the REPL, we'd need to create our own search implementation, as currently we rely on `lunr` as a dev dep and making a non-dev-dep is not desired, as we try to minimize any and all production dependencies.

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

贡献指南

打开贡献指南

调研方向

This is an RFC rather than an implementation task and does not name a REPL source file or test. Start by locating the stdlib REPL entry point and reading lib/node_modules/@stdlib/_tools/search/pkg-index, which the issue identifies as prior art. Done would require settling the search behavior, result modes, fuzzy matching, and dependency strategy before implementation.

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

评估

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

把新 issue 发到你的邮箱

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