-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
165 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) | ||
|
||
def compose(raw_initialize) | ||
require "ruby_lsp/setup_bundler" | ||
require "json" | ||
require "uri" | ||
require "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_gemfile"), env["BUNDLE_GEMFILE"]) | ||
File.write(File.join(".ruby-lsp", "locked_bundler_version"), env["BUNDLER_VERSION"]) if env["BUNDLER_VERSION"] | ||
end | ||
|
||
# When this is invoked on Windows, we pass the raw initialize as an argument to this script. On other platforms, we | ||
# invoke the compose method from inside a forked process | ||
raw_initialize = ARGV.first | ||
compose(raw_initialize) if raw_initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters