Skip to content

Commit f776615

Browse files
committed
Re-adjust logic.
1 parent 0644c1f commit f776615

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/extension.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,24 @@ function gitignoreGlobs(root: string): string[] {
6464
}
6565

6666
function configIgnoredGlobs(root: string): string[] {
67-
const configFilesExclude = Object.assign(
68-
[],
69-
vscode.workspace.getConfiguration('advancedNewFile').get('exclude')
67+
const configFilesExcluded: {
68+
[key: string]: boolean;
69+
} = Object.assign(
70+
{},
71+
vscode.workspace.getConfiguration('advancedNewFile').get('exclude'),
72+
(
73+
vscode.workspace
74+
.getConfiguration('advancedNewFile')
75+
.get('useFilesExclude', true)
76+
) ?
77+
vscode.workspace
78+
.getConfiguration('files', vscode.Uri.file(root))
79+
.get('exclude', {})
80+
: {}
7081
);
71-
if (
72-
vscode.workspace
73-
.getConfiguration('advancedNewFile')
74-
.get('useFilesExclude', true)
75-
) {
76-
configFilesExclude.push(
77-
...vscode.workspace
78-
.getConfiguration('files')
79-
.get('exclude', [vscode.Uri.file(root)])
80-
);
81-
}
82-
const configIgnored = Object.keys(configFilesExclude).filter(
83-
(key) => configFilesExclude[key] === true
82+
const configIgnored = Object.keys(configFilesExcluded).filter(
83+
(key) => configFilesExcluded[key] === true
8484
);
85-
8685
return gitignoreToGlob(configIgnored.join('\n'), {string: true});
8786
}
8887

0 commit comments

Comments
 (0)