feat: add DSH IDE open-file references

This commit is contained in:
2026-08-17 11:52:48 +08:00
commit d96c11ae3d
42 changed files with 6991 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { describe, expect, it } from 'vitest'
import { candidateFromItem, serializeIdeReference } from '../src/client.js'
const item = {
path: 'F:\\project\\a&b.ts',
label: 'a&b.ts',
dirty: true,
ide: 'vscode' as const,
instanceId: 'one',
workspace: 'F:\\project',
instanceOpenCount: 4,
}
describe('client reference projection', () => {
it('keeps the path in a structured JSON payload', () => {
expect(serializeIdeReference(item.path)).toBe('<ide-open-file>{"path":"F:\\\\project\\\\a&b.ts"}</ide-open-file>')
})
it('shows IDE, count and dirty state', () => {
const candidate = candidateFromItem(item)
expect(candidate.description).toContain('VS Code')
expect(candidate.description).toContain('4 open')
expect(candidate.description).toContain('unsaved changes')
})
})