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

References are marked as external when the path includes a dot #1049

Closed
1 task done
tsvetomir opened this issue Jun 10, 2019 · 2 comments · Fixed by #1052
Closed
1 task done

References are marked as external when the path includes a dot #1049

tsvetomir opened this issue Jun 10, 2019 · 2 comments · Fixed by #1052
Labels
bug Functionality does not match expectation

Comments

@tsvetomir
Copy link
Contributor

tsvetomir commented Jun 10, 2019

Expected Behavior

A dot (".") in the project path should have no effect on the generated documentation.

Actual Behavior

References such as classes.INameInterface are treated as external when the project path contains a dot.

Steps to reproduce the bug

  1. Rename examples/basic to examples/basic.dot
  2. Execute the run script in the folder
  3. Observe that INameInterface is no longer an internal reference in json.json (sample):
{
  "type": {
    "type": "reference",
    "name": "classes.INameInterface"
   }
}

Normally it would be (sample):

{
  "type": {
    "type": "reference",
    "name": "INameInterface",
    "id": 19
   }
}

Environment

  • Typedoc version: 0.15.0-0
  • Node.js version: v10.15.1
  • OS: OSX 10.14.5
@tsvetomir tsvetomir added the bug Functionality does not match expectation label Jun 10, 2019
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 12, 2019

Huh, well that's unexpected, I'll have to find some time to look at the internal/external distinction to figure out what's going on someday..

Related: #927

@tsvetomir
Copy link
Contributor Author

tsvetomir commented Jun 12, 2019

I've traced the issue to lib/converter/types/alias.ts:

let symbolName = checker.getFullyQualifiedName(type.symbol).split('.');
if (!symbolName.length) {
    return false;
}
if (symbolName[0].substr(0, 1) === '"') {
    symbolName.shift();
}

Here the symbolName array would contain extra parts that will not be filtered by the last check above:

[ '"/private/tmp/typedoc/examples/basic',
  'dot/src/classes"',
  'INameInterface' ]

The path seems to be enclosed in quotes so we can remove it with a Regex (yay, we have two problems now!):

const checker = context.checker;
const fqn = checker.getFullyQualifiedName(type.symbol);

let symbolName = fqn.replace(/"[^"]*"\./, '').split('.');
if (!symbolName.length) {
    return false;
}

Does this seem reasonable? I've submitted the patch in #1052 for review.

Gerrit0 pushed a commit that referenced this issue Jul 5, 2019
* fix: references marked as external if path has dots

Closes #1049

* refactor: ignore quotes in path

* Remove quotes from path since it breaks on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants