Skip to content
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

feat: smarter indentation detection. #9

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Conversation

autonomousapps
Copy link
Collaborator

Probably a bit on the expensive side, but I think it's a bit more intuitive to use than SmartIndent.

It's more intuitive because users don't have to call setIndent() in one of the listener functions (failing to do this is very common). They can simply get the indentation level when instantiating their listeners.

Probably a bit on the expensive side, but I think it's a bit more intuitive to use than SmartIndent.
* discovered is the common indent level. If no indent discovered (which could happen if this
* input contains only top-level statements), defaults to [min].
*/
public fun computeIndent(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like this function because it feels like a poor man's regex, and the whole point of creating a parse tree is avoiding regex -- nonetheless, dealing with whitespace has proven to be a huge pain, this works, and I think we ought to be able to further improve it.

@autonomousapps autonomousapps marked this pull request as ready for review July 15, 2024 20:11
@autonomousapps autonomousapps merged commit 23b4335 into main Jul 15, 2024
1 check passed
@autonomousapps autonomousapps deleted the trobalik.indendation branch July 15, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant