Skip to content

Commit

Permalink
feat: add setting to not follow symlinks (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
KcZer0 authored Nov 28, 2021
1 parent d624c42 commit 964faee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/autocomplete-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function activate() {
const cacheOptions = [
"core.ignoredNames",
"core.excludeVcsIgnoredPaths",
"autocomplete-paths.followSymlinks",
"autocomplete-paths.ignoreSubmodules",
"autocomplete-paths.ignoredNames",
"autocomplete-paths.ignoredPatterns",
Expand Down
5 changes: 5 additions & 0 deletions lib/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export const config = {
"Suggestion priority of this provider. If set to a number larger than or equal to 1, suggestions will be displayed on top of default suggestions.",
default: 2,
},
followSymlinks: {
type: "boolean",
default: false,
description: "Follow directory symlinks. Disable if you have a self-referencing symlink.",
},
ignoredNames: {
type: "boolean",
default: true,
Expand Down
5 changes: 4 additions & 1 deletion lib/paths-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default class PathsCache extends EventEmitter {
ignoredNames: atom.config.get("core.ignoredNames"),
ignoredPatterns: atom.config.get("autocomplete-paths.ignoredPatterns"),
maxFileCount: atom.config.get("autocomplete-paths.maxFileCount"),
followSymlinks: atom.config.get("autocomplete-paths.followSymlinks"),
}
}

Expand Down Expand Up @@ -192,7 +193,7 @@ export default class PathsCache extends EventEmitter {
.watch([projectPath, ...ignored], {
persistent: true,
ignoreInitial: true, // do not run the listeners on the initial scan
followSymlinks: false,
followSymlinks: this.config.followSymlinks,
interval: 1000,
binaryInterval: 1000,
})
Expand Down Expand Up @@ -467,6 +468,7 @@ export default class PathsCache extends EventEmitter {
cwd: rootDirectory,
onlyFiles: true,
absolute: true,
followSymbolicLinks: this.config.followSymlinks,
}
)
return (
Expand Down Expand Up @@ -504,6 +506,7 @@ export default class PathsCache extends EventEmitter {
dot: true,
cwd: directoryPath,
onlyFiles: true,
followSymbolicLinks: this.config.followSymlinks,
}
)
this._filePathsByProjectDirectory.set(directoryPath, files)
Expand Down

0 comments on commit 964faee

Please sign in to comment.