Skip to content

fix: warn when markdown link path casing doesn't match actual file on…#227

Open
vibhumeh wants to merge 1 commit into
microsoft:mainfrom
vibhumeh:fix/case-sensitive-path-validation
Open

fix: warn when markdown link path casing doesn't match actual file on…#227
vibhumeh wants to merge 1 commit into
microsoft:mainfrom
vibhumeh:fix/case-sensitive-path-validation

Conversation

@vibhumeh

Copy link
Copy Markdown

Fixes #106

On case insensitive filesystems (macOS and Windows), workspace.stat()
succeeds even when path casing doesn't match the actual file on disk.
This means a link like text silently resolves
even when the real file is docs/whitepaper.pdf, then breaks when
deployed to a case-sensitive system like GitHub (Linux).

Changes:

  • Adds link.file-path-casing-mismatch diagnostic code
  • Adds validateFileLinksMarkdownCaseSensitive option to DiagnosticOptions
    (defaults to true, set to false to opt out)
  • After a file is confirmed to exist, readDirectory() on the parent
    verifies the exact basename casing matches

Note: this behavior cannot be fully unit tested with InMemoryWorkspace
since it simulates a case-sensitive filesystem. The casing check only
triggers on macOS/Windows where workspace.stat() succeeds despite path
casing mismatches, as documented in the VS Code API.

@vibhumeh

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

Figure out what to do about case insensitive file systems (if anything)

1 participant