Skip to content

Commit 86cbccb

Browse files
committed
Add setting to control symbolic link display.
1 parent c07c93f commit 86cbccb

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
"type": "boolean",
8181
"default": true,
8282
"description": "Whether to use the values from `files.exclude` when deciding which folders to ignore."
83+
},
84+
"advancedNewFile.showSymlinks": {
85+
"type": "boolean",
86+
"default": true,
87+
"description": "Whether to show symbolic links when listing direcotries."
8388
}
8489
}
8590
}

src/extension.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ function isDirectorySymlink(p: string): boolean {
127127
return fs.lstatSync(sp).isDirectory();
128128
}
129129

130-
function isDirectoryOrDirectorySymlink(p: string): boolean {
131-
return isDirectory(p) || isDirectorySymlink(p);
132-
}
133-
134130
function directoriesSync(root: string): FSLocation[] {
135131
const ignore: string[] = [];
136132
if (
@@ -145,17 +141,24 @@ function directoriesSync(root: string): FSLocation[] {
145141
const results = globSync('**', {
146142
cwd: root,
147143
ignore: ignore.map(invertGlob),
148-
symlinks: true
144+
symlinks: vscode.workspace
145+
.getConfiguration('advancedNewFile')
146+
.get('showSymlinks', true)
149147
})
150148
.map((f): FSLocation => {
151149
return {
152150
relative: path.join(path.sep, f),
153151
absolute: path.join(root, f)
154152
};
155153
})
156-
.filter((f) => isDirectoryOrDirectorySymlink(f.absolute))
157-
.map((f) => f);
158-
154+
.filter(
155+
(f) =>
156+
isDirectory(f.absolute) ||
157+
(isDirectorySymlink(f.absolute) &&
158+
vscode.workspace
159+
.getConfiguration('advancedNewFile')
160+
.get('showSymlinks', true))
161+
);
159162
return results;
160163
}
161164

0 commit comments

Comments
 (0)