Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "require 'uri'" for LSP #156

Merged
merged 1 commit into from Jun 19, 2020
Merged

Add "require 'uri'" for LSP #156

merged 1 commit into from Jun 19, 2020

Conversation

pocke
Copy link
Contributor

@pocke pocke commented Jun 19, 2020

Steep langserver uses uri library but it isn't required.

$ git grep URI
lib/steep/drivers/watch.rb:              uri = URI.parse(response[:params][:uri])
lib/steep/server/code_worker.rb:            uri: URI.parse(project.absolute_path(path).to_s).tap {|uri| uri.scheme = "file"},
lib/steep/server/code_worker.rb:            paths = request[:params][:arguments].map {|arg| source_path(URI.parse(arg)) }
lib/steep/server/code_worker.rb:          path = source_path(URI.parse(request[:params][:textDocument][:uri]))
lib/steep/server/interaction_worker.rb:          uri = URI.parse(request[:params][:textDocument][:uri])
lib/steep/server/interaction_worker.rb:          uri = URI.parse(params[:textDocument][:uri])
lib/steep/server/master.rb:          uri = URI.parse(message[:params][:textDocument][:uri])
lib/steep/server/signature_worker.rb:        path = source_path(URI.parse(request[:params][:textDocument][:uri]))
lib/steep/server/signature_worker.rb:              uri: URI.parse(project.absolute_path(path).to_s).tap {|uri| uri.scheme = "file"},
lib/steep/server/utils.rb:        path = source_path(URI.parse(request[:params][:textDocument][:uri]))
test/code_worker_test.rb:        assert_equal Pathname("lib/success.rb"), project.relative_path(Pathname(URI.parse(uri).path))
test/code_worker_test.rb:        assert_equal Pathname("lib/annotation_syntax_error.rb"), project.relative_path(Pathname(URI.parse(uri).path))
test/code_worker_test.rb:        assert_equal Pathname("lib/ruby_syntax_error.rb"), project.relative_path(Pathname(URI.parse(uri).path))

So the langserver raises an error.

This pull request fixes this problem by adding a require.

Copy link
Owner

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@soutaro
Copy link
Owner

soutaro commented Jun 19, 2020

@pocke Let me confirm. Did it cause a real problem? (I guess it shouldn't have caused any problem because it is loaded by rubygems.)

@pocke
Copy link
Contributor Author

pocke commented Jun 19, 2020

@pocke Let me confirm. Did it cause a real problem? (I guess it shouldn't have caused any problem because it is loaded by rubygems.)

Yes, I guess the cause is ruby HEAD. I got the error with Ruby built with the master branch. Maybe the HEAD of rubygems removes URI dependency.

@pocke
Copy link
Contributor Author

pocke commented Jun 19, 2020

rubygems/bundler#7460 Rubygems starts to use vendored URI since this PR.

@soutaro
Copy link
Owner

soutaro commented Jun 19, 2020

I got it! It totally makes sense. Thanks. 🙏

@soutaro soutaro merged commit 24363d7 into soutaro:master Jun 19, 2020
@pocke pocke deleted the require-uri branch June 19, 2020 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants