Skip to content

[RFC]: add support for signature argument hints in the REPL #2065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
kgryte opened this issue Mar 27, 2024 · 0 comments
Open
3 tasks done

[RFC]: add support for signature argument hints in the REPL #2065

kgryte opened this issue Mar 27, 2024 · 0 comments
Labels
difficulty: 3 Likely to be challenging but manageable. Enhancement Issue or pull request for enhancing existing functionality. JavaScript Issue involves or relates to JavaScript. Needs Discussion Needs further discussion. priority: Normal Normal priority concern or feature request. REPL Issue or pull request specific to the project REPL. RFC Request for comments. Feature requests and proposed changes.

Comments

@kgryte
Copy link
Member

kgryte commented Mar 27, 2024

Description

This RFC proposes adding support for signature argument hints in the REPL. The idea is to extend the preview completion functionality introduced in #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 #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

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@kgryte kgryte added Enhancement Issue or pull request for enhancing existing functionality. RFC Request for comments. Feature requests and proposed changes. Needs Discussion Needs further discussion. difficulty: 3 Likely to be challenging but manageable. REPL Issue or pull request specific to the project REPL. priority: Normal Normal priority concern or feature request. JavaScript Issue involves or relates to JavaScript. labels Mar 27, 2024
@kgryte kgryte changed the title [RFC]: add support for signature auto-suggestions in the REPL [RFC]: add support for signature argument hints in the REPL Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: 3 Likely to be challenging but manageable. Enhancement Issue or pull request for enhancing existing functionality. JavaScript Issue involves or relates to JavaScript. Needs Discussion Needs further discussion. priority: Normal Normal priority concern or feature request. REPL Issue or pull request specific to the project REPL. RFC Request for comments. Feature requests and proposed changes.
Projects
None yet
Development

No branches or pull requests

1 participant