@@ -45,7 +45,8 @@ export class WorkspaceProvider
4545 private _checked_items : Map < string , vscode . TreeItemCheckboxState > = new Map ( )
4646 private _checked_timestamps : Map < string , number > = new Map ( )
4747 private _combined_gitignore = ignore ( )
48- private _user_ignore : Ignore = ignore ( )
48+ private _user_ignore_patterns : Ignore = ignore ( )
49+ private _user_allow_patterns : Ignore = ignore ( )
4950 private _watcher : vscode . FileSystemWatcher
5051 private _ranges_watcher : vscode . FileSystemWatcher
5152 private _gitignore_watcher : vscode . FileSystemWatcher
@@ -89,7 +90,10 @@ export class WorkspaceProvider
8990
9091 this . _config_change_handler = vscode . workspace . onDidChangeConfiguration (
9192 ( event ) => {
92- if ( event . affectsConfiguration ( 'codeWebChat.ignorePatterns' ) ) {
93+ if (
94+ event . affectsConfiguration ( 'codeWebChat.ignorePatterns' ) ||
95+ event . affectsConfiguration ( 'codeWebChat.allowPatterns' )
96+ ) {
9397 this . _load_ignore_patterns ( )
9498 this . _uncheck_ignored_files ( )
9599 this . refresh ( )
@@ -1346,19 +1350,29 @@ export class WorkspaceProvider
13461350 return true
13471351 }
13481352
1353+ if ( this . _user_allow_patterns . ignores ( relative_path ) ) {
1354+ return false
1355+ }
1356+
13491357 return this . _combined_gitignore . ignores ( relative_path )
13501358 }
13511359
13521360 private _load_ignore_patterns ( ) {
13531361 const config = vscode . workspace . getConfiguration ( 'codeWebChat' )
13541362 const patterns = config . get < string [ ] > ( 'ignorePatterns' )
1355- this . _user_ignore = ignore ( )
1363+ this . _user_ignore_patterns = ignore ( )
13561364 if ( patterns ) {
1357- this . _user_ignore . add ( patterns )
1365+ this . _user_ignore_patterns . add ( patterns )
13581366 }
13591367
1360- this . _user_ignore . add ( IGNORE_PATTERNS )
1361- this . _user_ignore . add ( 'node_modules' )
1368+ this . _user_ignore_patterns . add ( IGNORE_PATTERNS )
1369+ this . _user_ignore_patterns . add ( 'node_modules' )
1370+
1371+ const allow_patterns = config . get < string [ ] > ( 'allowPatterns' )
1372+ this . _user_allow_patterns = ignore ( )
1373+ if ( allow_patterns ) {
1374+ this . _user_allow_patterns . add ( allow_patterns )
1375+ }
13621376
13631377 // Clear token caches since exclusions have changed
13641378 this . _token_calculator . clear_caches ( )
@@ -1369,10 +1383,16 @@ export class WorkspaceProvider
13691383 if ( ! workspace_root ) {
13701384 // To handle files outside of a workspace, we can only check filename patterns
13711385 const basename = path . basename ( file_path )
1372- return this . _user_ignore . ignores ( basename )
1386+ if ( this . _user_allow_patterns . ignores ( basename ) ) {
1387+ return false
1388+ }
1389+ return this . _user_ignore_patterns . ignores ( basename )
13731390 }
13741391 const relative_path = path . relative ( workspace_root , file_path )
1375- return this . _user_ignore . ignores ( relative_path )
1392+ if ( this . _user_allow_patterns . ignores ( relative_path ) ) {
1393+ return false
1394+ }
1395+ return this . _user_ignore_patterns . ignores ( relative_path )
13761396 }
13771397
13781398 public is_partially_checked ( path : string ) : boolean {
0 commit comments