-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
Revert "Optimize project root detection. " #474
Conversation
…-python/issues/28. Logic: detecting via projectile or project; If nil, use the current directory.
…-python/issues/28. Logic: detecting via projectile or project; If nil, use the current directory.
…-python/issues/28. Logic: detecting via projectile or project; If nil, use the current directory.
…-python/issues/28. Logic: detecting via projectile or project; If nil, use the current directory.
…-python/issues/28. Logic: detecting via projectile or project; If nil, use the current directory.
Optimize project root detection.
I would not take side in this discussion, I just want to mention that force push breaks melpa since it cannot fetch sources. |
Two cents here.
|
@yyoncho Melpa uses commit date. When a new good commit lands, the Melpa version will get updated. @seagle0128 The owner can make wiki publicly editable so that everyone can contribute the best practice. The behavior difference of |
@MaskRay I did a force push in |
@MaskRay thanks, I guess something else went wrong. |
(I haven't invested a lot of time in Emacs world, apologizes if I say something wrong about Emacs. However I do spent a lot of time in understanding LSP, the following idea is based on how language servers work) I think the new behavior is going to affect not only C/C++ language servers, but all language servers, except those who does not care about project root at all. So it should be reverted. (Maybe pyls is in this class, I'm not sure) Notice that the case mentioned by @MaskRay is not limited to C/C++. What would happen if you open If we do want to make this assumption, we should notify all downstream language server maintainers, or at least put a big warning here, because, it is, in my opinion, pretty insane. |
@seagle0128 I did some digging related to
|
@yyoncho it should work. Thanks! I agree to revert as long as all are described clearly in the doc. BTW, how to handle for project package? |
Can you elaborate? |
@yyoncho Sure. We need more time to think and discuss. |
I have reverted the previous change. Let's try to make |
file watcher receives them in some cases those notifications should not trigger build we are also unable to update dirty flag Fixes emacs-lsp#474
Reverts #470
#470 consisted of 7 commits changing the single place back and forth and that PR got merged with an open issue unaddressed. I don't understand why it got approved and merged eventually. Disregarding the below technical reason, the commits should have been squashed if it was to be merged.
The fallback to
default-directory
is not a good choice for many language servers as many of them are designed for projects, not arbitrary directories with a single file.In reality (e.g. when it comes to C/C++ language servers), some files (
/usr/include/stdio.h
) are in an indeterminate state and don't belong to any specific projects (default-directory /usr/include/
will be bad). The enhancement in workspace folders and session management may help the situation. But before that becomes fully satisfactory, the reasonable approach here is forlsp--suggest-project-root
to returnnil
and just don't start the language server. When those buffers are jumped to from other buffers with associated projects, mark them as "stolen" by those projects.I understand that in some circumstances the language servers are lenient and the single file is accepted, but please use:
(setq projectile-require-project-root nil)
. Useprojectile-ensure-project
as mentioned by @seagle0128 .project-vc-external-root-functions
to allow arbitrary directory to be a project. @seagle0128Or if the behavior is really reasonable enough, make it a client-specific
:get-root
setting as @BooAA suggested. This does not make much sense as a lsp-mode default.The 7 commits made history browsing very difficult. I recommend making a force push to the state before that patch series. @vibhavp @yyoncho