Module: PlatformosCheck::LanguageServer::PartialCompletionProvider

Instance Method Summary collapse

Instance Method Details

#completions(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/platformos_check/language_server/partial_completion_provider.rb', line 6

def completions(context)
  content = context.buffer.lines[context.line]
  cursor = context.col
  @file_name = nil

  return [] if content.nil?
  return [] unless cursor_on_quoted_argument?(content, cursor)

  files
    .select { |x| x.name.start_with?(@file_name) }
    .map { |x| file_to_completion(x, context) }
end