mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Delay the require of the vscode-ripgrep module
Since a new RipgrepDirectorySearcher is constructed during the snapshot creation, we cannot require vscode-ripgrep from there (since it's not in the snapshot).
This commit is contained in:
@@ -74,10 +74,6 @@ function updateTrailingContexts (message, pendingTrailingContexts, options) {
|
||||
}
|
||||
|
||||
module.exports = class RipgrepDirectorySearcher {
|
||||
constructor () {
|
||||
this.rgPath = require('vscode-ripgrep').rgPath
|
||||
}
|
||||
|
||||
canSearchDirectory () {
|
||||
return true
|
||||
}
|
||||
@@ -116,6 +112,11 @@ module.exports = class RipgrepDirectorySearcher {
|
||||
// Returns a *thenable* `DirectorySearch` that includes a `cancel()` method. If `cancel()` is
|
||||
// invoked before the `DirectorySearch` is determined, it will resolve the `DirectorySearch`.
|
||||
search (directories, regexp, options) {
|
||||
// Delay the require of vscode-ripgrep to not mess with the snapshot creation.
|
||||
if (!this.rgPath) {
|
||||
this.rgPath = require('vscode-ripgrep').rgPath
|
||||
}
|
||||
|
||||
const paths = directories.map(d => d.getPath())
|
||||
|
||||
const args = ['--json', '--regexp', regexp.source]
|
||||
|
||||
Reference in New Issue
Block a user