Class: LSP::LSPBase
- Inherits:
-
Object
show all
- Defined in:
- lib/lsp/lsp_base.rb
Direct Known Subclasses
ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse, CallHierarchyClientCapabilities, CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem, CallHierarchyOptions, CallHierarchyOutgoingCall, CallHierarchyOutgoingCallsParams, CallHierarchyPrepareParams, CallHierarchyRegistrationOptions, CallHierarchyServerCapabilities, CodeAction, CodeActionClientCapabilities, CodeActionContext, CodeActionOptions, CodeActionParams, CodeActionRegistrationOptions, CodeLens, CodeLensClientCapabilities, CodeLensOptions, CodeLensParams, CodeLensRegistrationOptions, Color, ColorInformation, ColorPresentation, ColorPresentationParams, Command, CompileNodeGraphResponse, CompletionClientCapabilities, CompletionContext, CompletionItem, CompletionList, CompletionOptions, CompletionParams, CompletionRegistrationOptions, ConfigurationClientCapabilities, ConfigurationItem, ConfigurationParams, CreateFile, CreateFileOptions, DeclarationClientCapabilities, DeclarationOptions, DeclarationParams, DeclarationRegistrationOptions, DefinitionClientCapabilities, DefinitionOptions, DefinitionParams, DefinitionRegistrationOptions, DeleteFile, DeleteFileOptions, Diagnostic, DiagnosticRelatedInformation, DidChangeConfigurationClientCapabilities, DidChangeConfigurationParams, DidChangeConfigurationRegistrationOptions, DidChangeTextDocumentParams, DidChangeWatchedFilesClientCapabilities, DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions, DidChangeWorkspaceFoldersParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams, DocumentColorClientCapabilities, DocumentColorOptions, DocumentColorParams, DocumentColorRegistrationOptions, DocumentFormattingClientCapabilities, DocumentFormattingOptions, DocumentFormattingParams, DocumentFormattingRegistrationOptions, DocumentHighlight, DocumentHighlightClientCapabilities, DocumentHighlightOptions, DocumentHighlightParams, DocumentHighlightRegistrationOptions, DocumentLink, DocumentLinkClientCapabilities, DocumentLinkOptions, DocumentLinkParams, DocumentLinkRegistrationOptions, DocumentOnTypeFormattingClientCapabilities, DocumentOnTypeFormattingOptions, DocumentOnTypeFormattingParams, DocumentOnTypeFormattingRegistrationOptions, DocumentRangeFormattingClientCapabilities, DocumentRangeFormattingOptions, DocumentRangeFormattingParams, DocumentRangeFormattingRegistrationOptions, DocumentSymbol, DocumentSymbolClientCapabilities, DocumentSymbolOptions, DocumentSymbolParams, DocumentSymbolRegistrationOptions, ExecuteCommandClientCapabilities, ExecuteCommandOptions, ExecuteCommandParams, ExecuteCommandRegistrationOptions, FileEvent, FileSystemWatcher, FoldingRange, FoldingRangeClientCapabilities, FoldingRangeOptions, FoldingRangeParams, FoldingRangeRegistrationOptions, FormattingOptions, Hover, HoverClientCapabilities, HoverOptions, HoverParams, HoverRegistrationOptions, ImplementationClientCapabilities, ImplementationOptions, ImplementationParams, ImplementationRegistrationOptions, InitializeError, InitializeResult, InitializedParams, Location, LocationLink, LogMessageParams, MarkupContent, MessageActionItem, ParameterInformation, PartialResultParams, Position, PrepareRenameParams, PublishDiagnosticsClientCapabilities, PublishDiagnosticsParams, PuppetFactResponse, PuppetFixDiagnosticErrorsRequest, PuppetFixDiagnosticErrorsResponse, PuppetNodeGraphResponse, PuppetResourceResponse, PuppetVersion, PuppetfileDependencyResponse, Range, ReferenceClientCapabilities, ReferenceContext, ReferenceOptions, ReferenceParams, ReferenceRegistrationOptions, Registration, RegistrationParams, RenameClientCapabilities, RenameFile, RenameFileOptions, RenameOptions, RenameParams, RenameRegistrationOptions, ResourceOperation, SaveOptions, SelectionRange, SelectionRangeClientCapabilities, SelectionRangeOptions, SelectionRangeParams, SelectionRangeRegistrationOptions, SemanticTokens, SemanticTokensClientCapabilities, SemanticTokensEdit, SemanticTokensEdits, SemanticTokensEditsParams, SemanticTokensEditsPartialResult, SemanticTokensLegend, SemanticTokensOptions, SemanticTokensParams, SemanticTokensPartialResult, SemanticTokensRangeParams, SemanticTokensRegistrationOptions, SemanticTokensServerCapabilities, ShowMessageParams, ShowMessageRequestParams, SignatureHelp, SignatureHelpClientCapabilities, SignatureHelpContext, SignatureHelpOptions, SignatureHelpParams, SignatureHelpRegistrationOptions, SignatureInformation, StaticRegistrationOptions, SymbolInformation, TextDocument, TextDocumentChangeEvent, TextDocumentChangeRegistrationOptions, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, TextDocumentRegistrationOptions, TextDocumentSaveRegistrationOptions, TextDocumentSyncClientCapabilities, TextDocumentSyncOptions, TextDocumentWillSaveEvent, TextEdit, TypeDefinitionClientCapabilities, TypeDefinitionOptions, TypeDefinitionParams, TypeDefinitionRegistrationOptions, Unregistration, UnregistrationParams, VersionedTextDocumentIdentifier, WillSaveTextDocumentParams, WorkDoneProgressBegin, WorkDoneProgressCancelParams, WorkDoneProgressClientCapabilities, WorkDoneProgressCreateParams, WorkDoneProgressEnd, WorkDoneProgressOptions, WorkDoneProgressParams, WorkDoneProgressReport, WorkspaceChange, WorkspaceEdit, WorkspaceEditClientCapabilities, WorkspaceFolder, WorkspaceFoldersChangeEvent, WorkspaceFoldersClientCapabilities, WorkspaceFoldersInitializeParams, WorkspaceFoldersServerCapabilities, WorkspaceSymbolClientCapabilities, WorkspaceSymbolOptions, WorkspaceSymbolParams, WorkspaceSymbolRegistrationOptions
Instance Method Summary
collapse
Constructor Details
#initialize(initial_hash = nil) ⇒ LSPBase
Returns a new instance of LSPBase.
7
8
9
|
# File 'lib/lsp/lsp_base.rb', line 7
def initialize(initial_hash = nil)
from_h!(initial_hash) unless initial_hash.nil?
end
|
Instance Method Details
#from_h!(value) ⇒ Object
30
|
# File 'lib/lsp/lsp_base.rb', line 30
def from_h!(value); end
|
#to_h ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/lsp/lsp_base.rb', line 11
def to_h
value = {}
optional_names = @optional_method_names.nil? ? [] : @optional_method_names
instance_method_names.each do |name|
item_value = send(name)
if item_value.is_a?(Array)
item_value = item_value.map { |item| item.respond_to?(:to_h) ? item.to_h : item }
elsif !item_value.nil? && item_value.respond_to?(:to_h)
item_value = item_value.to_h
end
valuename = name.to_s.end_with?('__lsp') ? name.to_s[0...-5] : name.to_s
value[valuename] = item_value unless optional_names.include?(name) && item_value.nil?
end
value
end
|
#to_json(*options) ⇒ Object
32
33
34
|
# File 'lib/lsp/lsp_base.rb', line 32
def to_json(*options)
to_h.to_json(options)
end
|