-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Fix resolution of reference tags in a referenced docstring #1487
base: main
Are you sure you want to change the base?
Conversation
…associated with a different object
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.
Just some thoughts.
@@ -102,6 +106,7 @@ def self.new!(text, tags = [], object = nil, raw_data = nil, ref_object = nil) | |||
# with. | |||
def initialize(content = '', object = nil) | |||
@object = object | |||
@namespace = object |
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 kind of seems like .namespace
is just a dupe of .object
? Or, at the very least, that namespace could be a combination of @object || @unresolved_reference
and thus no attribute would be needed.
@@ -224,7 +224,8 @@ def create_tag(tag_name, tag_buf = '') | |||
|
|||
# Creates a {Tags::RefTag} | |||
def create_ref_tag(tag_name, name, object_name) | |||
@tags << Tags::RefTagList.new(tag_name, P(object, object_name), name) | |||
namespace = object && object.docstring ? object.docstring.namespace : object | |||
@tags << Tags::RefTagList.new(tag_name, P(namespace, object_name), name) |
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.
(See above) I could be wrong but it seems like namespace
could be replaced entirely by object || @unresolved_reference
and thus be the only necessary line of implementation.
When a docstring X is a reference to another docstring Y, any reference tags within docstring Y are resolved using the namespace of X, causing resolution to fail when X and Y are in different namespaces. This PR adds Docstring#namespace which follows the resolved reference.
Completed Tasks
bundle exec rake
locally (if code is attached to PR).