-
Notifications
You must be signed in to change notification settings - Fork 121
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
Public API for calculating indentation #665
Comments
Would you mind sharing your use case of it? That'll help us decide how the API could look like to better fit your needs. |
This API is mainly needed to be used in the Currently, the indentation calculation uses an internal API that changes from version to version. It is inconvenient to maintain it. That's why there is a need for a public API. |
For now, here are some idea how to calculate indentation. Use a formatter or a language serverI think Indent calculation is similar to code formatting. Maybe there's an API in formatter or language server. Use a parser/tokenizer libraryOne way to calculate indent is to use error tolerant parser like YARP or RubyVM::AbstractSyntaxTree(ruby>=3.3). Fork and make an indent calculation libraryIRB's current indent calculation is here. |
Description
Hi! IRB in multistring expressions adds appropriate indents to the next line. However, there is no API to get the indent value for the next line.
As far as I know, right now you can only get the indentation in some hacky way via an internal API. The internal API changes frequently and so the stability of such a hacky implementation suffers. It would be great to have a public API for this. Thank you!
The text was updated successfully, but these errors were encountered: