Sha256: eadbc639e9bda93fc9483d8a3bff7556af076a133e7510200c5c977edcaac00e

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

module Steep
  module Server
    module Utils
      LSP = LanguageServer::Protocol

      def source_path(uri)
        project.relative_path(Pathname(uri.path))
      end

      def update_source(request)
        path = source_path(URI.parse(request[:params][:textDocument][:uri]))
        text = request[:params][:contentChanges][0][:text]
        version = request[:params][:textDocument][:version]

        Steep.logger.debug "Updateing source: path=#{path}, version=#{version}, size=#{text.bytesize}"

        project.targets.each do |target|
          case
          when target.source_file?(path)
            target.update_source path, text
          when target.possible_source_file?(path)
            target.add_source path, text
          when target.signature_file?(path)
            target.update_signature path, text
          when target.possible_signature_file?(path)
            target.add_signature path, text
          end
        end

        if block_given?
          yield path, version
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
steep-0.29.0 lib/steep/server/utils.rb
steep-0.28.0 lib/steep/server/utils.rb
steep-0.27.0 lib/steep/server/utils.rb
steep-0.25.0 lib/steep/server/utils.rb
steep-0.24.0 lib/steep/server/utils.rb
steep-0.23.0 lib/steep/server/utils.rb
steep-0.22.0 lib/steep/server/utils.rb
steep-0.21.0 lib/steep/server/utils.rb
steep-0.20.0 lib/steep/server/utils.rb
steep-0.19.0 lib/steep/server/utils.rb
steep-0.18.0 lib/steep/server/utils.rb
steep-0.17.1 lib/steep/server/utils.rb
steep-0.17.0 lib/steep/server/utils.rb
steep-0.16.3 lib/steep/server/utils.rb
steep-0.16.2 lib/steep/server/utils.rb
steep-0.16.1 lib/steep/server/utils.rb
steep-0.16.0 lib/steep/server/utils.rb