paths

Replace node:path with vscode-uri Utils for cross-platform file operations in TypeScript projects.

1.0k|453|Updated Jun 21, 2017
One-click install
npx skills add https://github.com/forcedotcom/salesforcedx-vscode --skill paths
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: paths
Source: https://github.com/forcedotcom/salesforcedx-vscode/tree/main/.claude/skills/paths
Command: npx skills add https://github.com/forcedotcom/salesforcedx-vscode --skill paths

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

vscode path handling can become inconsistent across platforms when mixing node:path utilities with filesystem manipulations. This skill guides you to prefer vscode-uri URIs and the Utils API to normalize path handling in TypeScript projects.

Core Features & Use Cases

  • Prefer vscode-uri Utils for path operations (join, basename, dirname, extname) over node:path to ensure cross-platform consistency.
  • Use URI↔path conversions via FsService: toUri(filePath) and uriToPath(uri) for seamless interop between URIs and paths.
  • Raw path to URI: use URI.file(path) or toUri for memfs in web contexts to maintain consistent access patterns.
  • Align /src imports and path joins with vscode-uri-based utilities to reduce platform-specific bugs and improve code portability.

Quick Start

Configure your project to replace node:path with vscode-uri Utils for all /src path operations.

Frequently Asked Questions about paths

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle cross-platform path issues in TypeScript projects?

To avoid cross-platform path issues in TypeScript, replace node:path utilities with vscode-uri Utils functions like joinPath, basename, dirname, and extname to normalize file operations across different operating systems.

What's the best way to convert file paths to URIs in a web extension context?

The best way to convert raw file paths to URIs in web contexts is using URI.file(path) or the FsService toUri method for memory filesystems, maintaining consistent URI-based access patterns throughout your application.

Why does node:path cause inconsistent behavior in VS Code extensions?

Node:path causes inconsistent behavior because it relies on platform-specific string formatting, whereas vscode-uri normalizes file operations into URIs, ensuring consistent cross-platform behavior for your TypeScript code.

Can I use vscode-uri Utils to replace all node:path operations in my /src directory?

Yes, you can replace node:path operations in your /src directory by using vscode-uri Utils. Apply Utils.joinPath, Utils.basename, Utils.dirname, and Utils.extname for all path manipulations to improve code portability and reduce platform-specific bugs.

How do I convert between URIs and file paths using FsService?

You can convert between URIs and file paths using FsService methods: call toUri(filePath) to change a path into a URI, and uriToPath(uri) to convert a URI back into a file path for seamless interoperability.

Does vscode-uri work with TypeScript toolchains that rely on node:path?

vscode-uri works with TypeScript toolchains by providing explicit guidance on toolchain compatibility, allowing you to safely transition /src imports and path joins away from node:path toward vscode-uri-based utilities.