Skip to content

limit indent size to 8 - #5

Open
Konfekt wants to merge 2 commits into
timakro:mainfrom
Konfekt:patch-1
Open

limit indent size to 8#5
Konfekt wants to merge 2 commits into
timakro:mainfrom
Konfekt:patch-1

Conversation

@Konfekt

@Konfekt Konfekt commented Mar 3, 2024

Copy link
Copy Markdown
Contributor

addresses #4

@timakro

timakro commented Mar 4, 2024

Copy link
Copy Markdown
Owner

I think the intent was to fall back to user preferences or file-type defaults in the case of a unrealistically large indentation?

For example, given a file like this

curl https://example.com/ -H "Content-Type: application/json" \
                          -H "Accept: application/json"

you wouldn't want to set shiftwidth and and softtabstop to 8, right?

You probably had something more like de2fd6c in mind.

@Konfekt

Konfekt commented Mar 4, 2024

Copy link
Copy Markdown
Contributor Author

Yes, such an example. User preferences are fine as well. I was not sure whether you preferred a max value instead.
While at it, I noticed that some computation are only needed in special cases and moved them inside if clauses

@timakro

timakro commented Mar 4, 2024

Copy link
Copy Markdown
Owner

I don't mean to make the maximum indentation value configurable, sorry for the confusion. I think 8 is good. I was trying to say that your PR would change shiftwidth and softtabstop given my example file while the intent as I understand it is to not change those settings in this scenario.

@Konfekt

Konfekt commented Mar 4, 2024

Copy link
Copy Markdown
Contributor Author

Yes, counting only up to 8 is a better solution, thank you.
I adapted this PR accordingly, if there's still interest.

Edit: indent is computed relative to the last indent

@Konfekt Konfekt mentioned this pull request Mar 4, 2024
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