Skip to content

Commit c5c64bf

Browse files
committed
Fix onTypeFormat with spaces tabs
1 parent f1d6428 commit c5c64bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Providers/DocumentFormattingEditProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ type formattingStyle = {
1111
};
1212

1313
function getFormattingStyle(options: vscode.FormattingOptions): formattingStyle {
14-
const styleName: 'tight' | 'default' = vscode.workspace.getConfiguration('tmlanguage-syntax-highlighter').get('formattingStyle');
14+
const bracketStyle: 'tight' | 'default' = vscode.workspace.getConfiguration('tmlanguage-syntax-highlighter').get('formattingStyle');
1515
const style: formattingStyle = {
1616
tabType: options.insertSpaces ? ' ' : '\t',
1717
tabSize: options.insertSpaces ? options.tabSize : 1,
18-
wsBrackets: styleName == 'tight' ? '' : ' ',
18+
wsBrackets: bracketStyle == 'tight' ? '' : ' ',
1919
};
2020
return style;
2121
}
@@ -114,7 +114,7 @@ export const OnTypeFormattingEditProvider: vscode.OnTypeFormattingEditProvider =
114114
let parent = node.parent;
115115
while (parent) {
116116
parent = parent.parent;
117-
level++;
117+
level += style.tabSize;
118118
};
119119

120120
const indent = Math.min(level, node.startPosition.column);

0 commit comments

Comments
 (0)