Sha256: 5a374f46f8eefef7a88fc3f58921f37a6ec0702787bd79faacd8d9cdb3bf5f09

Contents?: true

Size: 626 Bytes

Versions: 6

Compression:

Stored size: 626 Bytes

Contents

# typed: true
# frozen_string_literal: true

def compose(raw_initialize)
  require_relative "../setup_bundler"
  require "json"
  require "uri"
  require_relative "../../core_ext/uri"

  initialize_request = JSON.parse(raw_initialize, symbolize_names: true)
  workspace_uri = initialize_request.dig(:params, :workspaceFolders, 0, :uri)
  workspace_path = workspace_uri && URI(workspace_uri).to_standardized_path
  workspace_path ||= Dir.pwd

  env = RubyLsp::SetupBundler.new(workspace_path, launcher: true).setup!
  File.write(
    File.join(".ruby-lsp", "bundle_env"),
    env.map { |k, v| "#{k}=#{v}" }.join("\n"),
  )
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-lsp-0.22.1 lib/ruby_lsp/scripts/compose_bundle.rb
ruby-lsp-0.22.0 lib/ruby_lsp/scripts/compose_bundle.rb
ruby-lsp-0.21.3 lib/ruby_lsp/scripts/compose_bundle.rb
ruby-lsp-0.21.2 lib/ruby_lsp/scripts/compose_bundle.rb
ruby-lsp-0.21.1 lib/ruby_lsp/scripts/compose_bundle.rb
ruby-lsp-0.21.0 lib/ruby_lsp/scripts/compose_bundle.rb