Skip to content

Commit

Permalink
Access ws tab length through options
Browse files Browse the repository at this point in the history
  • Loading branch information
poorna2152 committed Oct 16, 2023
1 parent 1108daa commit 5a4dbaf
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4482,13 +4482,14 @@ private void preserveIndentation(boolean value) {
*/
private int getPreservedIndentation(Token token) {
int position = token.lineRange().startLine().offset();
int offset = position % 4;
if (env.currentIndentation % 4 == 0 && env.currentIndentation > position) {
int tabSize = options.getTabSize();
int offset = position % tabSize;
if (env.currentIndentation % tabSize == 0 && env.currentIndentation > position) {
return env.currentIndentation;
}
if (offset != 0) {
if (offset > 2) {
position = position + 4 - offset;
position = position + tabSize - offset;
} else {
position = position - offset;
}
Expand Down

0 comments on commit 5a4dbaf

Please sign in to comment.