Class: PlatformosCheck::LanguageServer::CompletionProvider
- Inherits:
-
Object
- Object
- PlatformosCheck::LanguageServer::CompletionProvider
- Includes:
- CompletionHelper, RegexHelpers
- Defined in:
- lib/platformos_check/language_server/completion_provider.rb
Direct Known Subclasses
AssignmentsCompletionProvider, BackgroundPartialCompletionProvider, FilterCompletionProvider, FunctionPartialCompletionProvider, GraphqlPartialCompletionProvider, IncludePartialCompletionProvider, ObjectAttributeCompletionProvider, ObjectCompletionProvider, RenderPartialCompletionProvider, TagCompletionProvider
Defined Under Namespace
Classes: CurrentToken
Constant Summary
Constants included from RegexHelpers
RegexHelpers::HTML_LIQUID_PLACEHOLDER, RegexHelpers::LIQUID_TAG, RegexHelpers::LIQUID_TAG_OR_VARIABLE, RegexHelpers::LIQUID_VARIABLE, RegexHelpers::START_OR_END_QUOTE
Constants included from CompletionHelper
PlatformosCheck::LanguageServer::CompletionHelper::WORD
Instance Attribute Summary collapse
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Class Method Summary collapse
Instance Method Summary collapse
- #completions(relative_path, line, col) ⇒ Object
- #doc_hash(content) ⇒ Object
- #format_hash(entry) ⇒ Object
-
#initialize(storage = InMemoryStorage.new) ⇒ CompletionProvider
constructor
A new instance of CompletionProvider.
Methods included from RegexHelpers
Methods included from CompletionHelper
#cursor_on_first_word?, #cursor_on_start_content?, #first_word
Constructor Details
#initialize(storage = InMemoryStorage.new) ⇒ CompletionProvider
Returns a new instance of CompletionProvider.
23 24 25 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 23 def initialize(storage = InMemoryStorage.new) @storage = storage end |
Instance Attribute Details
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
9 10 11 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 9 def storage @storage end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 14 def all @all ||= [] end |
.inherited(subclass) ⇒ Object
18 19 20 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 18 def inherited(subclass) all << subclass end |
Instance Method Details
#completions(relative_path, line, col) ⇒ Object
27 28 29 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 27 def completions(relative_path, line, col) raise NotImplementedError end |
#doc_hash(content) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 31 def doc_hash(content) return {} if content.nil? || content.empty? { documentation: { kind: MarkupKinds::MARKDOWN, value: content } } end |
#format_hash(entry) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/platformos_check/language_server/completion_provider.rb', line 42 def format_hash(entry) return {} unless entry return { sortText: entry.name } unless entry.deprecated? { tags: [CompletionItemTag::DEPRECATED], sortText: "~#{entry.name}" } end |