Skip to content

Missing location info if passed source files in a parent directory #15888

Open
@Blacksmoke16

Description

@Blacksmoke16

Bug Report

Discovered via mkdocstrings/crystal#10.

I have a class:

class Foo
  def run
    1
  end
end

That's in a directory structure like:

testing/
├── foo.cr
└── sub-dir

Generating docs for this type from the parent of testing/, the reported location of Foo#run is:

$ crystal docs --format=json --project-name= --project-version= --source-refname=master ./testing/foo.cr | oq '.program.types[0].instance_methods[0].location'
{
  "filename": "testing/foo.cr",
  "line_number": 2,
  "url": null
}

From within testing/:

$ crystal docs --format=json --project-name= --project-version= --source-refname=master ./foo.cr | oq '.program.types[0].instance_methods[0].location'
{
  "filename": "foo.cr",
  "line_number": 2,
  "url": null
}

But running it from testing/sub-dir:

$ crystal docs --format=json --project-name= --project-version= --source-refname=master ../foo.cr | oq '.program.types[0].instance_methods[0].location'
null

Fails to determine the location. Versus having the filename be ../foo.cr?

I'm not sure if this is expected or not, but at least wanted to bring it up to see what other's thoughts are.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions