Skip to content

Conversation

@notEthan
Copy link
Contributor

@notEthan notEthan commented Mar 6, 2023

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

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

Copy link
Owner

@lsegal lsegal left a comment

Choose a reason for hiding this comment

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

Just some thoughts.

# with.
def initialize(content = '', object = nil)
@object = object
@namespace = object
Copy link
Owner

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.

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)
Copy link
Owner

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.

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.

2 participants