[ty] Make FileResolver::path return a full path by ntBre · Pull Request #20550 · astral-sh/ruff (original) (raw)

@ntBre

Fixes astral-sh/ty#1242.

From finding references with the LSP, FileResolver::path is only called once, in UnifiedFile::path, so I went through those references, and it looked safe to make this change in every case. Most of the references are in the various output formats, where we inherited the absolute vs relative path decision from Ruff. Two other uses are as fallbacks if converting a relativized path to a string fails. Finally, we use the path for sorting and in UnifiedFile::relative_path.

Existing tests, with snapshots updated to show absolute paths (in the TestDb this just added a / in front of the file names). I also updated the GitLab CLI test to set the CI_PROJECT_DIR environment variable and ran a test in GitLab CI:

MichaReiser

@ntBre ntBre marked this pull request as ready for review

September 24, 2025 14:20

@ntBre ntBre added bug

Something isn't working

ty

Multi-file analysis & type inference

labels

Sep 24, 2025

MichaReiser

@ntBre ntBre deleted the brent/fix-ty-gitlab-diagnostics branch

September 24, 2025 17:16

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})