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

The lines reported aren't the lines with errors #2605

Closed
regseb opened this issue Jun 22, 2024 · 2 comments
Closed

The lines reported aren't the lines with errors #2605

regseb opened this issue Jun 22, 2024 · 2 comments
Labels
bug Functionality does not match expectation
Milestone

Comments

@regseb
Copy link

regseb commented Jun 22, 2024

Search terms

line, code, block, markdown, README

Expected Behavior

The error lines reported correspond to the lines where there are problems.

Actual Behavior

Other lines are reported.

Steps to reproduce the bug

package.json

{
  "name": "testcase",
  "version": "1.0.0",
  "dependencies": {
    "typedoc": "0.26.0",
    "typescript": "5.5.2"
  }
}

README.md

foo
bar
baz
qux

```javascript
// Without this code block, the reported warning lines are good.
```

[quux](#quux)
[corge](#corge)
[grault](#grault)

tsconfig.json

{
  "typedocOptions": {
    "entryPoints": ["index.ts"]
  }
}

index.ts

// Unimportant.

Steps

  1. npm install

  2. npx typedoc

    ./README.md:3:1 - [warning] The relative path #quux does not exist
    
    3    baz
    
    ./README.md:5:8 - [warning] The relative path #corge does not exist
    
    5    ```javascript
    
    ./README.md:6:10 - [warning] The relative path #grault does not exist
    
    6    // Without this code block, the reported warning lines are good.
    
    [info] Documentation generated at ./docs
    [warning] Found 0 errors and 3 warnings
    

Environment

  • Typedoc version: 0.26.0
  • TypeScript version: 5.5.2
  • Node.js version: 20.14.0
  • OS: Ubuntu 22.04.4 LTS
@regseb regseb added the bug Functionality does not match expectation label Jun 22, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 22, 2024

Wow, this has been wrong since I originally added reporting for positions in non-ts source files... 2 years ago.

The issue is in MinimalSourceFile.getLineAndCharacterOfPosition, where it incorrectly handles multiple consecutive newlines.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 22, 2024

... well, that was one of the things that was wrong. The code block was revealing another bug too!

@Gerrit0 Gerrit0 added this to the v0.26.1 milestone Jun 22, 2024
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

No branches or pull requests

2 participants