mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
* feat(editor): add opt-in format on save Run project-configured stdin/stdout formatters before guarded saves, with an off-by-default setting, host-aware execution, and safe error fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(settings): localize formatter search terms and placeholder Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(editor): stub view state in Monaco fakes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(editor): skip SSH formatter guard when no formatter applies Unconfigured or excluded files in SSH workspaces now save silently instead of toasting a misleading reconnect error. Configured SSH formatters report that SSH hosts are not supported yet. Document that include globs skip dot-prefixed names unless listed explicitly. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { editorFormatterArgv } from './editor-formatter'
|
|
|
|
describe('formatter command arguments', () => {
|
|
it('substitutes quoted paths once without interpreting shell syntax in filenames', () => {
|
|
const file = "/repo/a ' $(touch nope) ${relativeFile}.ts"
|
|
expect(
|
|
editorFormatterArgv(
|
|
'formatter --stdin-filepath "${file}" --relative=${relativeFile}',
|
|
file,
|
|
'src/${file}.ts',
|
|
'darwin'
|
|
)
|
|
).toEqual(['formatter', '--stdin-filepath', file, '--relative=src/${file}.ts'])
|
|
})
|
|
|
|
it('keeps native Windows paths and executable spaces intact', () => {
|
|
expect(
|
|
editorFormatterArgv(
|
|
'"C:\\Program Files\\Formatter\\fmt.exe" --path "${file}"',
|
|
'C:\\repo\\a b.ts',
|
|
'a b.ts',
|
|
'win32'
|
|
)
|
|
).toEqual(['C:\\Program Files\\Formatter\\fmt.exe', '--path', 'C:\\repo\\a b.ts'])
|
|
})
|
|
|
|
it.each(['', 'formatter "unfinished', 'formatter --write ${file}', 'gofmt -w ${file}'])(
|
|
'rejects invalid or file-writing command %s',
|
|
(command) => {
|
|
expect(() => editorFormatterArgv(command, '/repo/a.ts', 'a.ts', 'linux')).toThrow()
|
|
}
|
|
)
|
|
})
|