@@ -30,48 +30,54 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
3030 terminalOutputLineLimit = 500 ,
3131 terminalOutputCharacterLimit = DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT ,
3232 maxWorkspaceFiles = 200 ,
33+ includeVSCodeFileContext = true ,
3334 } = state ?? { }
3435
35- // It could be useful for cline to know if the user went from one or no
36- // file to another between messages, so we always include this context.
37- details += "\n\n# VSCode Visible Files"
38-
39- const visibleFilePaths = vscode . window . visibleTextEditors
40- ?. map ( ( editor ) => editor . document ?. uri ?. fsPath )
41- . filter ( Boolean )
42- . map ( ( absolutePath ) => path . relative ( cline . cwd , absolutePath ) )
43- . slice ( 0 , maxWorkspaceFiles )
44-
45- // Filter paths through rooIgnoreController
46- const allowedVisibleFiles = cline . rooIgnoreController
47- ? cline . rooIgnoreController . filterPaths ( visibleFilePaths )
48- : visibleFilePaths . map ( ( p ) => p . toPosix ( ) ) . join ( "\n" )
49-
50- if ( allowedVisibleFiles ) {
51- details += `\n${ allowedVisibleFiles } `
52- } else {
53- details += "\n(No visible files)"
54- }
36+ // Only include VSCode file context if enabled in settings or if this is the first request
37+ const shouldIncludeVSCodeContext = includeFileDetails || includeVSCodeFileContext
38+
39+ if ( shouldIncludeVSCodeContext ) {
40+ // It could be useful for cline to know if the user went from one or no
41+ // file to another between messages, so we always include this context.
42+ details += "\n\n# VSCode Visible Files"
43+
44+ const visibleFilePaths = vscode . window . visibleTextEditors
45+ ?. map ( ( editor ) => editor . document ?. uri ?. fsPath )
46+ . filter ( Boolean )
47+ . map ( ( absolutePath ) => path . relative ( cline . cwd , absolutePath ) )
48+ . slice ( 0 , maxWorkspaceFiles )
5549
56- details += "\n\n# VSCode Open Tabs"
57- const { maxOpenTabsContext } = state ?? { }
58- const maxTabs = maxOpenTabsContext ?? 20
59- const openTabPaths = vscode . window . tabGroups . all
60- . flatMap ( ( group ) => group . tabs )
61- . map ( ( tab ) => ( tab . input as vscode . TabInputText ) ?. uri ?. fsPath )
62- . filter ( Boolean )
63- . map ( ( absolutePath ) => path . relative ( cline . cwd , absolutePath ) . toPosix ( ) )
64- . slice ( 0 , maxTabs )
65-
66- // Filter paths through rooIgnoreController
67- const allowedOpenTabs = cline . rooIgnoreController
68- ? cline . rooIgnoreController . filterPaths ( openTabPaths )
69- : openTabPaths . map ( ( p ) => p . toPosix ( ) ) . join ( "\n" )
70-
71- if ( allowedOpenTabs ) {
72- details += `\n${ allowedOpenTabs } `
73- } else {
74- details += "\n(No open tabs)"
50+ // Filter paths through rooIgnoreController
51+ const allowedVisibleFiles = cline . rooIgnoreController
52+ ? cline . rooIgnoreController . filterPaths ( visibleFilePaths )
53+ : visibleFilePaths . map ( ( p ) => p . toPosix ( ) ) . join ( "\n" )
54+
55+ if ( allowedVisibleFiles ) {
56+ details += `\n${ allowedVisibleFiles } `
57+ } else {
58+ details += "\n(No visible files)"
59+ }
60+
61+ details += "\n\n# VSCode Open Tabs"
62+ const { maxOpenTabsContext } = state ?? { }
63+ const maxTabs = maxOpenTabsContext ?? 20
64+ const openTabPaths = vscode . window . tabGroups . all
65+ . flatMap ( ( group ) => group . tabs )
66+ . map ( ( tab ) => ( tab . input as vscode . TabInputText ) ?. uri ?. fsPath )
67+ . filter ( Boolean )
68+ . map ( ( absolutePath ) => path . relative ( cline . cwd , absolutePath ) . toPosix ( ) )
69+ . slice ( 0 , maxTabs )
70+
71+ // Filter paths through rooIgnoreController
72+ const allowedOpenTabs = cline . rooIgnoreController
73+ ? cline . rooIgnoreController . filterPaths ( openTabPaths )
74+ : openTabPaths . map ( ( p ) => p . toPosix ( ) ) . join ( "\n" )
75+
76+ if ( allowedOpenTabs ) {
77+ details += `\n${ allowedOpenTabs } `
78+ } else {
79+ details += "\n(No open tabs)"
80+ }
7581 }
7682
7783 // Get task-specific and background terminals.
0 commit comments