-
Notifications
You must be signed in to change notification settings - Fork 161
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
Use prism v0.26.0 #1953
Use prism v0.26.0 #1953
Conversation
sorbet/rbi/fix.rbi
Outdated
@@ -0,0 +1,5 @@ | |||
module Prism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking with Kevin about this.
@@ -124,7 +124,7 @@ def extract_document_link(node) | |||
match = comment.location.slice.match(%r{source://.*#\d+$}) | |||
return unless match | |||
|
|||
uri = T.cast(URI(T.must(match[0])), URI::Source) | |||
uri = T.cast(URI(match[0]), URI::Source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorbet was complaining about the T.must
on untyped, but I'm not sure why it wasn't previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(previously it was T.nilable(String)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should cast location.slice
as String
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(@st0012 is investigating the underlying cause).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was caused by Tapioca dropping signatures of attr_reader
methods (issue). I've opened ruby/prism#2719 to convert them into normal method declarations (which Tapioca does anyway).
I also tested that when generating the rbi file from that branch, this change will not be necessary.
2969963
to
f546a24
Compare
@@ -83,7 +83,9 @@ def assert_corrects_to_expected(diagnostic_code, code_action_title, source, expe | |||
) | |||
|
|||
diagnostics = RubyLsp::Requests::Diagnostics.new(global_state, document).perform | |||
diagnostic = T.must(T.must(diagnostics).find { |d| d.code == diagnostic_code }) | |||
# The source of the returned attributes may be RuboCop or Prism. Prism diagnostics don't have a code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest Prism returns an additionanal diagnostic:
#<LanguageServer::Protocol::Interface::Diagnostic:0x000000012d318b88
@attributes=
{:range=>
#<LanguageServer::Protocol::Interface::Range:0x000000012d318d40
@attributes=
{:start=>#<LanguageServer::Protocol::Interface::Position:0x000000012d318f48 @attributes={:line=>0, :character=>0}>,
:end=>#<LanguageServer::Protocol::Interface::Position:0x000000012d318d90 @attributes={:line=>0, :character=>1}>}>,
:severity=>2,
:source=>"Prism",
:message=>"assigned but unused variable - a"}>,
I'm not yet sure if this impacts any other Ruby LSP behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should just surface these warnings as diagnostics, that should be fine.
- Bump PORTREVISION for package change Obtained from: Shopify/ruby-lsp#1953
I think we can merge this and update again after the next Prism release? |
@@ -83,7 +83,9 @@ def assert_corrects_to_expected(diagnostic_code, code_action_title, source, expe | |||
) | |||
|
|||
diagnostics = RubyLsp::Requests::Diagnostics.new(global_state, document).perform | |||
diagnostic = T.must(T.must(diagnostics).find { |d| d.code == diagnostic_code }) | |||
# The source of the returned attributes may be RuboCop or Prism. Prism diagnostics don't have a code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should just surface these warnings as diagnostics, that should be fine.
f546a24
to
3f0263c
Compare
Something is failing in CI for |
- Bump PORTREVISION for package change Obtained from: Shopify/ruby-lsp#1953
Motivation
Closes #1906