Files
orca/src/shared/quick-open-query-target.test.ts
T
Neil fff8718c76 Improve Quick Open matching, file locations and recent history (#25371)
* Match Quick Open queries across path terms and identifier separators

* Honor ignored-file and symlink preferences on file inventory hosts

* Open pasted file locations and remember successful workspace file visits

* Verify bounded directory listing preferences across execution routes

* Preserve symlink preferences on legacy directory fallback

* Preserve bounded Quick Open terms and separator alternatives

* Revoke stale Quick Open selections and preserve literal file locations

* Validate recent Quick Open candidates independently on their host

* Use complete old-host inventory fixtures for Quick Open compatibility

* Keep Quick Open validation current across palette and workspace changes

* Route recent candidates through relay file listing dispatch

* Record Quick Open hook renders as test snapshots

* Localize Quick Open eligibility errors and search aliases

* Validate file inventory with bundled search and runtime preferences

* test: use directory junction fixtures on Windows

* fix: negotiate Quick Open policies with nested SSH hosts

* fix: refresh cached linked folders after target changes

* Retry stale expanded links after reads settle and targets recover

* Scope stale refresh request lifetime to the visible workspace

* test: seed linked-folder fixture before watcher startup

* Keep Quick Open responsive and compatible with older hosts

* Exercise directory discovery with unprivileged Windows junctions
2026-10-05 21:52:28 -07:00

43 lines
1.3 KiB
TypeScript

import { expect, it } from 'vitest'
import { isQuickOpenAbsolutePath, parseQuickOpenQueryTarget } from './quick-open-query-target'
it.each([
['src/app.ts:12', { pathQuery: 'src/app.ts', line: 12 }],
['C:\\src\\app.ts:12:3', { pathQuery: 'C:\\src\\app.ts', line: 12, column: 3 }],
['\\\\server\\share\\app.ts:2', { pathQuery: '\\\\server\\share\\app.ts', line: 2 }],
['/home/a b/file.ts:7:8', { pathQuery: '/home/a b/file.ts', line: 7, column: 8 }],
['file:part:2', { pathQuery: 'file:part', line: 2 }]
])('parses the trailing location in %s', (query, target) => {
expect(parseQuickOpenQueryTarget(query)).toEqual(target)
})
it.each([
'C:12',
'file:0',
'file:1:0',
'file:1:',
'file:-2',
'file:1:9007199254740992',
'file::2',
'file:9007199254740992'
])('keeps invalid or ambiguous suffixes literal: %s', (query) => {
expect(parseQuickOpenQueryTarget(query)).toEqual({ pathQuery: query })
})
it.each([
'/home/app.ts',
'C:/src/app.ts',
'C:\\src\\app.ts',
'\\\\server\\share\\app.ts',
'//server/share/app.ts'
])('recognizes an absolute path: %s', (path) => {
expect(isQuickOpenAbsolutePath(path)).toBe(true)
})
it.each(['C:app.ts', 'src/app.ts', 'https://host/app.ts', '/tmp/\0bad'])(
'does not offer a direct path for %s',
(path) => {
expect(isQuickOpenAbsolutePath(path)).toBe(false)
}
)