Module: PlatformosCheck::LanguageServer

Defined in:
lib/platformos_check/language_server.rb,
lib/platformos_check/language_server/bridge.rb,
lib/platformos_check/language_server/server.rb,
lib/platformos_check/language_server/channel.rb,
lib/platformos_check/language_server/handler.rb,
lib/platformos_check/language_server/protocol.rb,
lib/platformos_check/language_server/constants.rb,
lib/platformos_check/language_server/messenger.rb,
lib/platformos_check/language_server/diagnostic.rb,
lib/platformos_check/language_server/uri_helper.rb,
lib/platformos_check/language_server/type_helper.rb,
lib/platformos_check/language_server/hover_engine.rb,
lib/platformos_check/language_server/io_messenger.rb,
lib/platformos_check/language_server/configuration.rb,
lib/platformos_check/language_server/hover_provider.rb,
lib/platformos_check/language_server/completion_engine.rb,
lib/platformos_check/language_server/completion_helper.rb,
lib/platformos_check/language_server/code_action_engine.rb,
lib/platformos_check/language_server/completion_context.rb,
lib/platformos_check/language_server/diagnostics_engine.rb,
lib/platformos_check/language_server/client_capabilities.rb,
lib/platformos_check/language_server/completion_provider.rb,
lib/platformos_check/language_server/diagnostics_manager.rb,
lib/platformos_check/language_server/code_action_provider.rb,
lib/platformos_check/language_server/document_link_engine.rb,
lib/platformos_check/language_server/document_link_provider.rb,
lib/platformos_check/language_server/execute_command_engine.rb,
lib/platformos_check/language_server/variable_lookup_finder.rb,
lib/platformos_check/language_server/execute_command_provider.rb,
lib/platformos_check/language_server/document_change_corrector.rb,
lib/platformos_check/language_server/variable_lookup_traverser.rb,
lib/platformos_check/language_server/partial_completion_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/constants.rb,
lib/platformos_check/language_server/hover_providers/tag_hover_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/liquid_fixer.rb,
lib/platformos_check/language_server/hover_providers/filter_hover_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/tolerant_parser.rb,
lib/platformos_check/language_server/variable_lookup_finder/potential_lookup.rb,
lib/platformos_check/language_server/variable_lookup_finder/assignments_finder.rb,
lib/platformos_check/language_server/completion_providers/tag_completion_provider.rb,
lib/platformos_check/language_server/completion_providers/filter_completion_provider.rb,
lib/platformos_check/language_server/completion_providers/object_completion_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/assignments_finder/scope.rb,
lib/platformos_check/language_server/code_action_providers/quickfix_code_action_provider.rb,
lib/platformos_check/language_server/completion_providers/assignments_completion_provider.rb,
lib/platformos_check/language_server/document_link_providers/asset_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/render_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/graphql_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/include_document_link_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb,
lib/platformos_check/language_server/completion_providers/render_partial_completion_provider.rb,
lib/platformos_check/language_server/document_link_providers/function_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/localize_document_link_provider.rb,
lib/platformos_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb,
lib/platformos_check/language_server/completion_providers/graphql_partial_completion_provider.rb,
lib/platformos_check/language_server/completion_providers/include_partial_completion_provider.rb,
lib/platformos_check/language_server/code_action_providers/source_fix_all_code_action_provider.rb,
lib/platformos_check/language_server/completion_providers/function_partial_completion_provider.rb,
lib/platformos_check/language_server/completion_providers/object_attribute_completion_provider.rb,
lib/platformos_check/language_server/document_link_providers/background_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb,
lib/platformos_check/language_server/completion_providers/background_partial_completion_provider.rb,
lib/platformos_check/language_server/document_link_providers/include_form_document_link_provider.rb,
lib/platformos_check/language_server/document_link_providers/theme_render_document_link_provider.rb,
lib/platformos_check/language_server/execute_command_providers/correction_execute_command_provider.rb,
lib/platformos_check/language_server/execute_command_providers/run_checks_execute_command_provider.rb

Defined Under Namespace

Modules: CompletionHelper, CompletionItemKinds, CompletionItemTag, ErrorCodes, MarkupKinds, PartialCompletionProvider, TextDocumentSyncKind, TypeHelper, URIHelper, VariableLookupFinder, VariableLookupTraverser Classes: AssetDocumentLinkProvider, AssignmentsCompletionProvider, BackgroundDocumentLinkProvider, BackgroundPartialCompletionProvider, Bridge, Channel, ClientCapabilities, CodeActionEngine, CodeActionProvider, CompletionContext, CompletionEngine, CompletionProvider, Configuration, CorrectionExecuteCommandProvider, Diagnostic, DiagnosticsEngine, DiagnosticsManager, DocumentChangeCorrector, DocumentLinkEngine, DocumentLinkProvider, DoneStreaming, ExecuteCommandEngine, ExecuteCommandProvider, FilterCompletionProvider, FilterHoverProvider, FunctionDocumentLinkProvider, FunctionPartialCompletionProvider, GraphqlDocumentLinkProvider, GraphqlPartialCompletionProvider, Handler, HoverEngine, HoverProvider, IOMessenger, IncludeDocumentLinkProvider, IncludeFormDocumentLinkProvider, IncludePartialCompletionProvider, IncompatibleStream, LocalizeDocumentLinkProvider, Messenger, ObjectAttributeCompletionProvider, ObjectCompletionProvider, QuickfixCodeActionProvider, RenderDocumentLinkProvider, RenderPartialCompletionProvider, RunChecksExecuteCommandProvider, Server, SourceFixAllCodeActionProvider, TagCompletionProvider, TagHoverProvider, ThemeRenderDocumentLinkProvider, TranslationDocumentLinkProvider

Constant Summary collapse

PARTIAL_RENDER =
partial_tag('render')
PARTIAL_THEME_RENDER =
partial_tag('theme_render', with_rc: true)
PARTIAL_INCLUDE =
partial_tag('include')
PARTIAL_INCLUDE_FORM =
partial_tag('include_form')
PARTIAL_FUNCTION =
partial_tag_with_result('function')
PARTIAL_GRAPHQL =
partial_tag_with_result('graphql')
PARTIAL_BACKGROUND =
partial_tag_with_result('background')
TAGS_FOR_FILTERS =
'echo|print|log|hash_assign|assign'
TRANSLATION_FILTERS_NAMES =
'translate|t_escape|translate_escape|t[^\\w]'
OPTIONAL_SCOPE_ARGUMENT =
%((:?([\\w:'"\\s]*)\\s*(scope:\\s*['"](?<scope>[^'"]*)['"]))?)
LOCALIZE_FILTERS_NAMES =
''
ASSET_INCLUDE =
/
  \{\{-?\s*'(?<partial>[^']*)'\s*\|\s*asset_url|
  \{\{-?\s*"(?<partial>[^"]*)"\s*\|\s*asset_url|

  # in liquid tags the whole line is white space until the asset partial
  ^\s*(?:#{TAGS_FOR_FILTERS}[^=]*=)\s*'(?<partial>[^']*)'\s*\|\s*asset_url|
  ^\s*(?:#{TAGS_FOR_FILTERS}[^=]*=)\s*"(?<partial>[^"]*)"\s*\|\s*asset_url
/mix
TRANSLATION_FILTER =
/
  '(?<key>[^']*)'\s*\|\s*(#{TRANSLATION_FILTERS_NAMES})#{OPTIONAL_SCOPE_ARGUMENT}|
  "(?<key>[^"]*)"\s*\|\s*(#{TRANSLATION_FILTERS_NAMES})#{OPTIONAL_SCOPE_ARGUMENT}
/mix
LOCALIZE_FILTER =
/
  [\s\w'"-:.]+\|\s*(localize|l):\s*'(?<key>[^']*)'|
  [\s\w'"-:.]+\|\s*(localize|l):\s*"(?<key>[^"]*)"
/mix

Class Method Summary collapse

Class Method Details

.partial_tag(tag, with_rc: false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/platformos_check/language_server/constants.rb', line 5

def self.partial_tag(tag, with_rc: false)
  /
    \{%-?\s*#{tag}#{'(_rc)?' if with_rc}\s+'(?<partial>[^']*)'|
    \{%-?\s*#{tag}#{'(_rc)?' if with_rc}\s+"(?<partial>[^"]*)"|

    # in liquid tags the whole line is white space until the tag
    ^\s*#{tag}#{'(_rc)?' if with_rc}\s+'(?<partial>[^']*)'|
    ^\s*#{tag}#{'(_rc)?' if with_rc}\s+"(?<partial>[^"]*)"
  /mix
end

.partial_tag_with_result(tag) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/platformos_check/language_server/constants.rb', line 16

def self.partial_tag_with_result(tag)
  /
    \{%-?\s*#{tag}\s+(?<var>[\w]+)\s*=\s*'(?<partial>[^']*)'|
    \{%-?\s*#{tag}\s+(?<var>[\w]+)\s*=\s*"(?<partial>[^"]*)"|

    # in liquid tags the whole line is white space until the tag
    ^\s*#{tag}\s+(?<var>[\w]+)+\s*=\s*'(?<partial>[^']*)'|
    ^\s*#{tag}\s+(?<var>[\w]+)+\s*=\s*"(?<partial>[^"]*)"
  /mix
end

.startObject



68
69
70
# File 'lib/platformos_check/language_server.rb', line 68

def self.start
  Server.new(messenger: IOMessenger.new).listen
end