brew/Library/Homebrew/bundle/vscode_extension_dumper.rb
Mike McQuaid d84fac5af4
Look for VSCode variants
We've had requests for this in Homebrew/bundle a few times so let's
implement it both for there and for `brew edit`.

Tested on my machine with `cursor` and working as expected.
2025-03-19 11:42:37 +00:00

29 lines
607 B
Ruby

# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
module Homebrew
module Bundle
module VscodeExtensionDumper
module_function
def reset!
@extensions = nil
end
def extensions
@extensions ||= if Bundle.vscode_installed?
Bundle.exchange_uid_if_needed! do
`"#{Bundle.which_vscode}" --list-extensions 2>/dev/null`
end.split("\n").map(&:downcase)
else
[]
end
end
def dump
extensions.map { |name| "vscode \"#{name}\"" }.join("\n")
end
end
end
end