atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 196 forks source link

Unable to specify complex path patterns for matching file/directory #985

Open ssbarnea opened 6 years ago

ssbarnea commented 6 years ago

Prerequisites

Description

As a power user I expect to be able to specify complex patterns for matching file/directories in Atom.

Steps to Reproduce

I tried foo/**/bar/** and foo/.*/bar/.* and I realised that none of them work.

Expected behavior:

Be able to respect the java style globing pattern which allows the first example. Have it documented in the sample text so user will learn how to use without having to read the documentation.

Actual behavior: Anything after ** is ignored so more files are found than expected.

Reproduces how often: Always

Versions

Atom    : 1.23.1
Electron: 1.6.15
Chrome  : 56.0.2924.87
Node    : 7.4.0
apm  1.18.11
npm  3.10.10
node 6.9.5 x64
atom 1.23.1
python 2.7.14
git 2.15.0

Additional Information

I do not have a strong preference upon the syntax being supported, which ever is easier to implement but the default example text should contain an example that explains it.

50Wliu commented 6 years ago

We use minimatch for glob matching. I am unaware if minimatch offers what you are looking for.

y-a-v-a commented 6 years ago

Had the same question. This might be of some help:

minimatch('basedir/projectcore/test/script.js', 'basedir/project+(core|)/**/*.js'); // true
minimatch('basedir/projectcore/test/script.js', '**/project+(core|)/**/*.js'); // true
minimatch('basedir/projectcore/test/script.js', '**/project*/**/*.js'); // true
minimatch('basedir/project/test/script.js', 'basedir/project+(core|)/**/*.js'); // true

// globstar not allowed in combination with string
minimatch('basedir/projectcore/test/script.js', '**/project*/**.js'); // false
minimatch('basedir/projectcore/test/script.js', '**/projectcore/**.js'); // false
jrial commented 6 years ago

This probably explains: https://github.com/isaacs/minimatch/issues/67

Seems it won't be fixed, unless someone comes up with a good PR. It looks like yarn has moved to micromatch for this specific reason: https://github.com/yarnpkg/yarn/pull/3339 - although what other issues that might introduce I have no clue about.