Sha256: e21d001393a48e71c72a801e06d3f5edc273a8f114c009843fd8e66335be6676

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require 'uri'

module Yoda
  class Server
    class RootlessWorkspace
      # @return [String]
      attr_reader :name

      # @param name [String]
      def initialize(name:)
        @name = name
      end

      def setup
        project.setup
      end

      # @return [Store::Project, nil]
      def project
        @project ||= Store::Project.temporal(name: name)
      end

      # @param path [String]
      def uri_of_path(path)
        FileStore.uri_of_path(File.expand_path(path))
      end

      # @param uri [String]
      # @return [String, nil]
      def read_at(uri)
        path = UriDecoder.path_of_uri(uri)
        path && file_tree.read_at(path)
      end

      # @param path []
      def read_source(uri)
        path = UriDecoder.path_of_uri(uri)
        file_tree.clear_editing_at(path)
      end

      # @param uri [String]
      # @param source [String]
      def store_source(uri:, source:)
        path = UriDecoder.path_of_uri(uri)
        file_tree.set_editing_at(path, source)
      end

      def suburi?(uri)
        true
      end

      def subpath?(path)
        true
      end

      # @return [Store::FileTree]
      def file_tree
        project.file_tree
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/server/rootless_workspace.rb
yoda-language-server-0.10.0 lib/yoda/server/rootless_workspace.rb
yoda-language-server-0.9.0 lib/yoda/server/rootless_workspace.rb
yoda-language-server-0.8.0 lib/yoda/server/rootless_workspace.rb