-
Notifications
You must be signed in to change notification settings - Fork 136
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
Prioritize Uris #648
Prioritize Uris #648
Conversation
If a module have several Uris prioritize them. Search for project related Uri first and prioritize modules in src dir. When working OTP reposiory we get at least two uris per module, one in src tree and one in otp release tree, when jumping to definition we want to jump to the one in the src tree and not to the release tree. Also some modules names are duplicated in tests dir, avoid these too. Now that the indexing is parallel the order is random, so it's not given where to go.
@dgud Can I ask you to share the |
Also, I am not sure we should take this decision for the user. For example, in the definition provider, the protocol allows multiple definitions to be sent to the client. I think the server should be as dumb as possible and return all of the possible ones. It should be the client to render them to the user (e.g. in a dropdown). Then, to solve the specific issue with the OTP code base, we may want to introduce a blacklist which would have to be configured via the config file. |
I have not used any erlang_ls.config, IMHO most projects should work decently without one. You can see this as an intermediate patch, until you fix that all references are returned, I have an installed erlang dev system 22.3 and the otp git repo, so the erlang_ls node will pick up all |
My idea is a bit different. The |
@robertoaloi that is basically the approach followed for haskell by using hie-bios |
See also #358 |
@dgud In general, yes (for example in code navigation or in the context of completions). Unfortunately, the |
I agree with the logic around dealing with it, in a well-defined way. This can hold the line until we have a build-server specific approach which should avoid the problem, and at the very least give us a point to tweak the priority algorithm if we find cases it does not handle properly. |
…_paths/2` erlang-ls#346 discarded any paths containing symlinks since they broke assumptions about there being a single URI for each module in calls to `els_utils:find_module/1`. erlang-ls#648 added prioritization for cases when there are multiple URIs in `els_utils:find_module/1`, so discarding paths with symlinks is now no longer necessary. Following symlinks is necessary when using rebar3 checkout dependencies (erlang-ls#1046) or when using Bazel (erlang-ls#1064) since Bazel places dependencies and compiled files under its cache directory and symlinks the relevant directory in the cache to the workspace directory. This change removes the behavior of `els_utils:resolve_paths/2` that discards paths containing symlinks.
#346 discarded any paths containing symlinks since they broke assumptions about there being a single URI for each module in calls to `els_utils:find_module/1`. #648 added prioritization for cases when there are multiple URIs in `els_utils:find_module/1`, so discarding paths with symlinks is now no longer necessary. Following symlinks is necessary when using rebar3 checkout dependencies (#1046) or when using Bazel (#1064) since Bazel places dependencies and compiled files under its cache directory and symlinks the relevant directory in the cache to the workspace directory. This change removes the behavior of `els_utils:resolve_paths/2` that discards paths containing symlinks.
If a module have several Uris prioritize them.
Search for project related Uri first and prioritize modules in src dir.
When working OTP reposiory we get at least two uris per module, one
in src tree and one in otp release tree, when jumping to definition
we want to jump to the one in the src tree and not to the release tree.
Also some modules names are duplicated in tests dir, avoid these too.
Now that the indexing is parallel the order is random, so it's not
given where to go.