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

Indentation Rules #306

Merged
merged 5 commits into from
Jan 29, 2023
Merged

Conversation

kyklish
Copy link
Contributor

@kyklish kyklish commented Dec 26, 2022

Changes proposed in this pull request:

  • add indentationRules to ahk.configuration.json

VS Code should adjust the indentation of current line or next line when you type, paste, and move lines.

Example:
Example

Raw text:

var
foo() {
    if expression
        code
    code
    if (expression)
        code
    if (expression) {
        code
    }

}

RegEx capture correctly, but VS Code won't work correctly on moving line upward. Any suggestions?
Indent +
Indent+
Indent -
Indent-

Can't make regex case insensitive: (?i:) not work

Indentation Rules

Notifying @mark-wiemer

@mark-wiemer
Copy link
Owner

mark-wiemer commented Jan 17, 2023

Let's merge this PR and open a couple issues: One for the fact that it doesn't work going up, and another to simplify the logic to use the same "change indentation" logic across the board. With this PR we'll have duplicated logic across the formatter and this code, won't we?

I'd still like to merge this PR as it's an improvement over the current behavior, right?

@kyklish
Copy link
Contributor Author

kyklish commented Jan 17, 2023

Open a couple issues: One for the fact that it doesn't work going up

Agree.

Simplify the logic to use the same "change indentation" logic across the board. With this PR we'll have duplicated logic across the formatter and this code, won't we?

Not agree. Formatter can't share this code at all. It's internal VS Code implementation. Theoretically we can implement in AHK++ FormatOnType provider and do all job manually, but again, I don't see how to share code with regular formatter.

On big scripts (>1k lines) there are noticible time execution of regular formatter. It can't do it in realtime.

I'd still like to merge this PR as it's an improvement over the current behavior, right?

Yes, it's very fast realtime formatting by VS Code implementation, why not use it :)

@kyklish
Copy link
Contributor Author

kyklish commented Jan 17, 2023

Created issue #319.

@mark-wiemer
Copy link
Owner

Sounds good, I'm still not 100% convinced we can't find some way to share this logic, but that's not a big deal. Thanks again for all your work on this project :)

@mark-wiemer mark-wiemer merged commit f8566da into mark-wiemer:main Jan 29, 2023
@mark-wiemer mark-wiemer mentioned this pull request Jan 29, 2023
@kyklish kyklish deleted the feature/indentation-rules branch January 30, 2023 04:22
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.

2 participants