mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #9236 from Microsoft/BaseIndentationSupport
[Salsa] Adding base indentation for script block formatting and smart indent
This commit is contained in:
@@ -1566,6 +1566,7 @@ namespace ts.server {
|
||||
|
||||
static getDefaultFormatCodeOptions(host: ServerHost): ts.FormatCodeOptions {
|
||||
return ts.clone({
|
||||
BaseIndentSize: 0,
|
||||
IndentSize: 4,
|
||||
TabSize: 4,
|
||||
NewLineCharacter: host.newLine || "\n",
|
||||
|
||||
5
src/server/protocol.d.ts
vendored
5
src/server/protocol.d.ts
vendored
@@ -438,6 +438,9 @@ declare namespace ts.server.protocol {
|
||||
/** Number of spaces to indent during formatting. Default value is 4. */
|
||||
indentSize?: number;
|
||||
|
||||
/** Number of additional spaces to indent during formatting to preserve base indentation (ex. script block indentation). Default value is 0. */
|
||||
baseIndentSize?: number;
|
||||
|
||||
/** The new line character to be used. Default value is the OS line delimiter. */
|
||||
newLineCharacter?: string;
|
||||
|
||||
@@ -478,7 +481,7 @@ declare namespace ts.server.protocol {
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
|
||||
/** Index operator */
|
||||
[key: string]: string | number | boolean;
|
||||
[key: string]: string | number | boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -703,6 +703,7 @@ namespace ts.server {
|
||||
if (lineText.search("\\S") < 0) {
|
||||
// TODO: get these options from host
|
||||
const editorOptions: ts.EditorOptions = {
|
||||
BaseIndentSize: formatOptions.BaseIndentSize,
|
||||
IndentSize: formatOptions.IndentSize,
|
||||
TabSize: formatOptions.TabSize,
|
||||
NewLineCharacter: formatOptions.NewLineCharacter,
|
||||
|
||||
Reference in New Issue
Block a user