mdx-js / mdx-analyzer

MDX extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx
MIT License
346 stars 21 forks source link

`mdx.validate.validateFileLinks` does not show diagnostics #465

Open karlhorky opened 3 months ago

karlhorky commented 3 months ago

Initial checklist

Affected packages and versions

MDX VS Code Extension v1.8.9

Link to runnable example

No response

Steps to reproduce

  1. Open app/message.mdx in the reproduction repo (code below)
  2. Observe that none of the 4 "incorrect path" permutations for the non-existent file mdx2.png report any diagnostics (both images and links, relative paths starting with ./ and "bare" paths without any ./)
## Links

[link relative](./mdx.png) and [link bare](mdx.png)

[link relative - incorrect path](./mdx2.png) and [link bare - incorrect path](mdx2.png)

## Images

![image relative](./mdx.png) and ![image bare](mdx.png)

![image relative - incorrect path](./mdx2.png) and ![image bare - incorrect path](mdx2.png)

Screenshot 2024-08-08 at 15 08 54

Expected behavior

Diagnostics and problems should be reported for non-existent files when mdx.validate.validateFileLinks is set to hint, warning or error

Actual behavior

Diagnostics and problems are not reported for non-existent files when mdx.validate.validateFileLinks is set to hint, warning or error

Runtime

No response

Package manager

No response

OS

macOS

Build and bundle tools

No response

polynook commented 1 month ago

I can observe the same behavior.

In my case, from all available validations, only one works, and that is the link.no-such-reference. The link.no-such-header-in-file validation also reports, although incorrectly—it reports an error when the header exists.

mdx.mdx file content:

[no-definition] {/* No link definition found: 'no-definition'(link.no-such-reference) */}
[empty-definition]()

[non-existing-file-relative](./not-existing-file)
[non-existing-file-absolute](not-existing-file)

[existing-file-relative](./existing-file.md)
[existing-file-absolute](/existing-file.md)

[existing-file-existing-header](./existing-file.md#existing-header) {/* Header does not exist in file: existing-header(link.no-such-header-in-file) */}
[existing-file-non-existing-header](./existing-file.md#non-existing-header) {/* Header does not exist in file: non-existing-header(link.no-such-header-in-file) */}

[non-existing-file-non-existing-header](./not-existing-file#non-existing-header)
[non-existing-file-non-existing-header](not-existing-file#non-existing-header)
- Header does not exist in file: my_file(link.no-such-header-in-file)

I used the exact same content in an md.md file as control, and all Markdown validations work with plain VS Code Markdown (except for [empty-definition]() not being flagged as no-definition, which I personally think should be flagged as such).

I did this test in a blank VS Code profile that has only MDX extension installed to exclude possible conflicts.