Skip to content

parity(#244): normalize path separators in resolve_chunk so find_related works on Windows #88

Description

@amondnet

Summary

Upstream semble #244 (b491200) fixed find_related on Windows: resolve_chunk now normalizes \/ on both the incoming file_path and each chunk's stored path before comparing. csp compares paths verbatim, so on Windows a file_path copied from a search result (or typed with the other separator) can fail to resolve.

Upstream

file_path = file_path.replace("\\", "/")
for chunk in chunks:
    if chunk.file_path.replace("\\", "/") == file_path and chunk.start_line <= line <= chunk.end_line:

csp status

  • crates/csp/src/utils.rs::resolve_chunk: chunk.file_path == file_path exact match. Not reflected.
  • csp stores chunk paths via Path::strip_prefix(display_root).to_string_lossy() (indexing/create.rs), i.e. the platform-native separator — same situation as upstream.
  • csp ships Windows binaries (x86_64-pc-windows-msvc in release-rust.yml), so this is reachable.

Tasks

  • Normalize separators in resolve_chunk (both sides), keeping the existing end-line fallback behavior.
  • Unit test: backslash input resolves a forward-slash chunk and vice versa.

Refs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:proposalProposal for discussiontype:bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions