* Convert full path to relative path using workspace root. * Ensures consistent cache keys using relative paths for security and portability.
(filePath: string)
| 110 | * Ensures consistent cache keys using relative paths for security and portability. |
| 111 | */ |
| 112 | private toRelativePath(filePath: string): string { |
| 113 | // Already relative (doesn't start with / or drive letter) |
| 114 | if (!filePath.startsWith('/') && !filePath.match(/^[A-Z]:\\/i)) { |
| 115 | return filePath; |
| 116 | } |
| 117 | // Convert absolute to relative |
| 118 | const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; |
| 119 | if (workspaceRoot && filePath.startsWith(workspaceRoot)) { |
| 120 | return filePath.slice(workspaceRoot.length).replace(/^[/\\]/, ''); |
| 121 | } |
| 122 | return filePath; |
| 123 | } |
| 124 | |
| 125 | private async initializeCache() { |
| 126 | const workspaceFolders = vscode.workspace.workspaceFolders; |
no outgoing calls
no test coverage detected