Class: LSP::FormattingOptions

Inherits:
LSPBase
  • Object
show all
Defined in:
lib/lsp/lsp_types.rb

Overview

export interface FormattingOptions

/**
 * Size of a tab in spaces.
 */
tabSize: number;
/**
 * Prefer spaces over tabs.
 */
insertSpaces: boolean;
/**
 * Trim trailing whitespaces on a line.
 *
 * @since 3.15.0
 */
trimTrailingWhitespace?: boolean;
/**
 * Insert a newline character at the end of the file if one does not exist.
 *
 * @since 3.15.0
 */
insertFinalNewline?: boolean;
/**
 * Trim all newlines after the final newline at the end of the file.
 *
 * @since 3.15.0
 */
trimFinalNewlines?: boolean;
/**
 * Signature for further properties.
 */
[key: string]: boolean | number | string | undefined;

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ FormattingOptions

Returns a new instance of FormattingOptions.



1335
1336
1337
1338
# File 'lib/lsp/lsp_types.rb', line 1335

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[trimTrailingWhitespace insertFinalNewline trimFinalNewlines]
end

Instance Attribute Details

#insertFinalNewlineObject

type: number # type: boolean # type: boolean # type: boolean # type: boolean



1333
1334
1335
# File 'lib/lsp/lsp_types.rb', line 1333

def insertFinalNewline
  @insertFinalNewline
end

#insertSpacesObject

type: number # type: boolean # type: boolean # type: boolean # type: boolean



1333
1334
1335
# File 'lib/lsp/lsp_types.rb', line 1333

def insertSpaces
  @insertSpaces
end

#tabSizeObject

type: number # type: boolean # type: boolean # type: boolean # type: boolean



1333
1334
1335
# File 'lib/lsp/lsp_types.rb', line 1333

def tabSize
  @tabSize
end

#trimFinalNewlinesObject

type: number # type: boolean # type: boolean # type: boolean # type: boolean



1333
1334
1335
# File 'lib/lsp/lsp_types.rb', line 1333

def trimFinalNewlines
  @trimFinalNewlines
end

#trimTrailingWhitespaceObject

type: number # type: boolean # type: boolean # type: boolean # type: boolean



1333
1334
1335
# File 'lib/lsp/lsp_types.rb', line 1333

def trimTrailingWhitespace
  @trimTrailingWhitespace
end

Instance Method Details

#from_h!(value) ⇒ Object



1340
1341
1342
1343
1344
1345
1346
1347
1348
# File 'lib/lsp/lsp_types.rb', line 1340

def from_h!(value)
  value = {} if value.nil?
  self.tabSize = value['tabSize']
  self.insertSpaces = value['insertSpaces'] # Unknown type
  self.trimTrailingWhitespace = value['trimTrailingWhitespace'] # Unknown type
  self.insertFinalNewline = value['insertFinalNewline'] # Unknown type
  self.trimFinalNewlines = value['trimFinalNewlines'] # Unknown type
  self
end