mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-09 08:15:05 +01:00
Create a new API proposal with TextEditorOptions.indentSize
This commit is contained in:
@@ -233,7 +233,7 @@ export class ChangeIndentationSizeAction extends EditorAction {
|
||||
: n === creationOpts.tabSize
|
||||
? nls.localize('defaultTabSize', "Default Tab Size")
|
||||
: n === modelOpts.tabSize
|
||||
? nls.localize('selectedTabSize', "Selected Tab Size")
|
||||
? nls.localize('currentTabSize', "Current Tab Size")
|
||||
: undefined
|
||||
)
|
||||
}));
|
||||
|
||||
@@ -165,10 +165,10 @@ export class ExtHostTextEditorOptions {
|
||||
set tabSize(value: number | string) {
|
||||
that._setTabSize(value);
|
||||
},
|
||||
get indentSize(): number | string {
|
||||
get indentSize(): number | 'tabSize' {
|
||||
return that._indentSize;
|
||||
},
|
||||
set indentSize(value: number | string) {
|
||||
set indentSize(value: number | 'tabSize') {
|
||||
that._setIndentSize(value);
|
||||
},
|
||||
get insertSpaces(): boolean | string {
|
||||
|
||||
@@ -258,7 +258,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
|
||||
test('can change indentSize to a string number', () => {
|
||||
opts.value.indentSize = '2';
|
||||
opts.value.indentSize = <any>'2';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 2,
|
||||
@@ -282,7 +282,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
|
||||
test('indentSize cannot request indentation detection', () => {
|
||||
opts.value.indentSize = 'auto';
|
||||
opts.value.indentSize = <any>'auto';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
@@ -318,7 +318,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 3', () => {
|
||||
opts.value.indentSize = 'hello';
|
||||
opts.value.indentSize = <any>'hello';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
@@ -330,7 +330,7 @@ suite('ExtHostTextEditorOptions', () => {
|
||||
});
|
||||
|
||||
test('ignores invalid indentSize 4', () => {
|
||||
opts.value.indentSize = '-17';
|
||||
opts.value.indentSize = <any>'-17';
|
||||
assertState(opts, {
|
||||
tabSize: 4,
|
||||
indentSize: 4,
|
||||
|
||||
@@ -36,6 +36,7 @@ export const allApiProposals = Object.freeze({
|
||||
findTextInFiles: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.findTextInFiles.d.ts',
|
||||
fsChunks: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',
|
||||
idToken: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts',
|
||||
indentSize: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.indentSize.d.ts',
|
||||
inlineCompletionsAdditions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts',
|
||||
interactiveWindow: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts',
|
||||
ipc: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',
|
||||
|
||||
Vendored
+1
-10
@@ -641,22 +641,13 @@ declare module 'vscode' {
|
||||
/**
|
||||
* The size in spaces a tab takes. This is used for two purposes:
|
||||
* - the rendering width of a tab character;
|
||||
* - the number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true
|
||||
* and `indentSize` is set to `"tabSize"`.
|
||||
* - the number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true.
|
||||
*
|
||||
* When getting a text editor's options, this property will always be a number (resolved).
|
||||
* When setting a text editor's options, this property is optional and it can be a number or `"auto"`.
|
||||
*/
|
||||
tabSize?: number | string;
|
||||
|
||||
/**
|
||||
* The number of spaces to insert when [insertSpaces](#TextEditorOptions.insertSpaces) is true.
|
||||
*
|
||||
* When getting a text editor's options, this property will always be a number (resolved).
|
||||
* When setting a text editor's options, this property is optional and it can be a number or `"tabSize"`.
|
||||
*/
|
||||
indentSize?: number | string;
|
||||
|
||||
/**
|
||||
* When pressing Tab insert {@link TextEditorOptions.tabSize n} spaces.
|
||||
* When getting a text editor's options, this property will always be a boolean (resolved).
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
/**
|
||||
* Represents a {@link TextEditor text editor}'s {@link TextEditor.options options}.
|
||||
*/
|
||||
export interface TextEditorOptions {
|
||||
/**
|
||||
* The size in spaces a tab takes. This is used for two purposes:
|
||||
* - the rendering width of a tab character;
|
||||
* - the number of spaces to insert when {@link TextEditorOptions.insertSpaces insertSpaces} is true
|
||||
* and `indentSize` is set to `"tabSize"`.
|
||||
*
|
||||
* When getting a text editor's options, this property will always be a number (resolved).
|
||||
* When setting a text editor's options, this property is optional and it can be a number or `"auto"`.
|
||||
*/
|
||||
tabSize?: number | string;
|
||||
/**
|
||||
* The number of spaces to insert when [insertSpaces](#TextEditorOptions.insertSpaces) is true.
|
||||
*
|
||||
* When getting a text editor's options, this property will always be a number (resolved).
|
||||
* When setting a text editor's options, this property is optional and it can be a number or `"tabSize"`.
|
||||
*/
|
||||
indentSize?: number | 'tabSize';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user