(filePath: string)
| 92 | } |
| 93 | |
| 94 | getCandidatesForFile(filePath: string): EditorSessionEntry[] { |
| 95 | const matchCheckResults = new Map<string, boolean>() |
| 96 | |
| 97 | const checkMatch = (entry: EditorSessionEntry): boolean => { |
| 98 | if (matchCheckResults.has(entry.socketPath)) { |
| 99 | return matchCheckResults.get(entry.socketPath)! |
| 100 | } |
| 101 | const result = entry.workspace.folders.some((folder) => filePath.startsWith(folder.uri.path + path.sep)) |
| 102 | matchCheckResults.set(entry.socketPath, result) |
| 103 | return result |
| 104 | } |
| 105 | |
| 106 | return Array.from(this.entries.values()) |
| 107 | .reverse() // Most recently registered first. |
| 108 | .sort((a, b) => { |
| 109 | // Matches first. |
| 110 | const aMatch = checkMatch(a) |
| 111 | const bMatch = checkMatch(b) |
| 112 | if (aMatch === bMatch) { |
| 113 | return 0 |
| 114 | } |
| 115 | if (aMatch) { |
| 116 | return -1 |
| 117 | } |
| 118 | return 1 |
| 119 | }) |
| 120 | } |
| 121 | |
| 122 | deleteSession(socketPath: string): void { |
| 123 | logger.debug(`Deleting session from session registry: ${socketPath}`) |
no outgoing calls
no test coverage detected