Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexing should skip test data directories #859

Closed
alanz opened this issue Jan 19, 2021 · 1 comment · Fixed by #1109 or #1122
Closed

indexing should skip test data directories #859

alanz opened this issue Jan 19, 2021 · 1 comment · Fixed by #1109 or #1122
Labels
bug Something isn't working

Comments

@alanz
Copy link
Contributor

alanz commented Jan 19, 2021

Describe the bug

Files in test/xxxx_SUITE_data directory are indexed.

In the case of https://github.com/WhatsApp/erlfmt/tree/master/test/erlfmt_SUITE_data, this has a unicode.erl module which clashes with the system one.

@alanz alanz added the bug Something isn't working label Jan 19, 2021
dgud added a commit to dgud/erlang_ls that referenced this issue Oct 5, 2021
Test data directories may contain erlang files with modules names
that clashes with application or system modules, ignore these
directories.

As one example in otp "lib/dialyzer/test/r9c_SUITE_data/src/" contains
the many files that clashes. This causes among other things that
jump to definition almost always jumps to the wrong place when working
inside OTP.
robertoaloi added a commit that referenced this issue Oct 6, 2021
@dgud
Copy link
Contributor

dgud commented Oct 14, 2021

And it don't work :-(
I tested this way to quick it seems, because after the indexing is completely done, files in SUITE_data are still found.

The cause is that els_indexing:index_dir/2 calls els_utils:fold_files/4 which is recursive.

This contradicts the recursive argument in els_config:project_paths which takes an argument recursive which
is false in most cases.

  ok = set(apps_paths     , project_paths(RootPath, AppsDirs, false)),
  ok = set(deps_paths     , project_paths(RootPath, DepsDirs, false)),
  ok = set(include_paths  , include_paths(RootPath, IncludeDirs, false)),
  ok = set(otp_paths      , otp_paths(OtpPath, false) -- ExcludePaths),
  ok = set(lenses         , Lenses),
  ok = set(diagnostics    , Diagnostics),
  %% All (including subdirs) paths used to search files with file:path_open/3
  ok = set( search_paths
          , lists:append([ project_paths(RootPath, AppsDirs, true)
                         , project_paths(RootPath, DepsDirs, true)
                         , include_paths(RootPath, IncludeDirs, false)
                         , otp_paths(OtpPath, true)
                         ])

But that doesn't seem to matter since in the end a recursive search is always used anyway,
at least in all places where els_utils:fold_files/4 is used.

How should we solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants