Sha256: 3e032aa2c4d9dd50c1b77c308ae34e4e14c93b04dccfaa764ca71859b595d60d

Contents?: true

Size: 952 Bytes

Versions: 5

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

module PlatformosCheck
  module LanguageServer
    class TranslationDocumentLinkProvider < DocumentLinkProvider
      @partial_regexp = TRANSLATION_FILTER
      @app_file_type = :translations
      @default_dir = 'translations'
      @default_extension = '.yml'

      def file_link(match, platformos_app)
        translation_file_link(match, platformos_app)
      end

      def translation_components_for_match(match)
        translation_components = match[:key].split('.')
        translation_components = match[:scope].split('.') + translation_components if match[:scope]
        [translation_components]
      end

      def start_coordinates(buffer, match)
        from_index_to_row_column(
          buffer,
          match.begin(:key)
        )
      end

      def end_coordinates(buffer, match)
        from_index_to_row_column(
          buffer,
          match.end(:key)
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
platformos-check-0.4.14 lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb
platformos-check-0.4.13 lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb
platformos-check-0.4.12 lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb
platformos-check-0.4.11 lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb
platformos-check-0.4.10 lib/platformos_check/language_server/document_link_providers/translation_document_link_provider.rb