Sha256: 3f4f7884d125f054065c9b552906f882ad26012855c2f1cccf80bd3e57ff597d
Contents?: true
Size: 620 Bytes
Versions: 25
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true module PlatformosCheck module LanguageServer module CompletionHelper WORD = /\w+/ def cursor_on_start_content?(content, cursor, regex) content.slice(0, cursor).match?(/#{regex}(?:\s|\n)*$/m) end def cursor_on_first_word?(content, cursor) word = content.match(WORD) return false if word.nil? word_start = word.begin(0) word_end = word.end(0) word_start <= cursor && cursor <= word_end end def first_word(content) content.match(WORD)[0] if content.match?(WORD) end end end end
Version data entries
25 entries across 25 versions & 1 rubygems