You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -56,8 +56,9 @@ function createPowerShellModelDescription(shell: string): string {
56
56
`This tool allows you to execute ${isWinPwsh ? 'Windows PowerShell 5.1' : 'PowerShell'} commands in a persistent terminal session, preserving environment variables, working directory, and other context across multiple commands.`,
57
57
'',
58
58
'Command Execution:',
59
-
// Even for pwsh 7+ we want to use `;` to chain commands since the tree sitter grammar
60
-
// doesn't parse `&&`. See https://github.com/airbus-cert/tree-sitter-powershell/issues/27
59
+
// TODO: Even for pwsh 7+ we want to use `;` to chain commands since the tree sitter grammar
60
+
// doesn't parse `&&`. We want to change this to avoid `&&` only in Windows PowerShell when
61
+
// the grammar supports it https://github.com/airbus-cert/tree-sitter-powershell/issues/27
61
62
'- Use semicolons ; to chain commands on one line, NEVER use && even when asked explicitly',
62
63
'- Prefer pipelines | for object-based data flow',
63
64
'- Never create a sub-shell (eg. powershell -c "command") unless explicitly asked',
test('should rewrite && to ; in PowerShell commands',()=>t('echo hello && echo world','echo hello ; echo world'));
380
+
test('should rewrite multiple && to ; in PowerShell commands',()=>t('echo first && echo second && echo third','echo first ; echo second ; echo third'));
381
+
test('should handle complex commands with && operators',()=>t('npm install && npm test && echo "build complete"','npm install ; npm test ; echo "build complete"'));
382
+
test('should work with Windows PowerShell shell identifier',()=>t('Get-Process && Stop-Process','Get-Process ; Stop-Process'));
383
+
test('should preserve existing semicolons',()=>t('echo hello; echo world && echo final','echo hello; echo world ; echo final'));
Copy file name to clipboardExpand all lines: src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/treeSitterCommandParser.test.ts
0 commit comments