-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
vscode support of editor.indentSize #13105
Conversation
1f54497
to
cde68b3
Compare
cde68b3
to
4a1f591
Compare
Thanks a lot for your review, @msujew ! I updated the code with your comments, this can be reviewed again. |
}; | ||
|
||
protected toModelOption(editorPreference: EditorPreferenceChange['preferenceName']): keyof ITextModelUpdateOptions | undefined { | ||
switch (editorPreference) { | ||
case 'editor.tabSize': return 'tabSize'; | ||
// @monaco-uplift: uncomment this line once 'editor.indentSize' preference is available | ||
// case 'editor.indentSize': return 'tabSize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Given that the previous question resulted in indentSize
, it should be here the same as well.
// case 'editor.indentSize': return 'tabSize'; | |
// case 'editor.indentSize': return 'indentSize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with new commit.
} | ||
this._indentSize = indentSize; | ||
} else if (val === 'tabSize') { | ||
this._indentSize = this._tabSize!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I believe this might yield incorrect values in case the tabSize
is changed after indentSize
has been set:
ext.tabSize = 2;
ext.indentSize = 'tabSize';
ext.tabSize = 4;
console.log(ext.indentSize) // prints '2'
It should store the 'tabSize'
value and return the current tabSize
value from the indentSize
getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this should be a better long term solution. Fixed in new version
Also updates tabSize, as API does not correspond to documentation. Contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
4a1f591
to
8f531e2
Compare
@msujew, thanks again for your review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me 👍
What it does
Fix missing API TextEditorOptions.indentSize made public on vscode 1.83 (was a proposed API before).
The behavior is available, but the preference requires an uplift of the monaco version. It is not yet available in the generated preferences.
Fixes #13058
Contributed on behalf of ST Microelectronics
How to test
The test can be done on a text file, using "Indent using spaces" and "Indent using tabs" commands. The behavior should be the same as before. Only the internals have changed.
The preferences test has to wait the monaco uplift.
The following provided extension can also show the value of identSize when the value has changed with an information message:
Follow-ups
Preferences need to be supported once a monaco uplift has been performed.
Review checklist
Reminder for reviewers