atom-languageclient icon indicating copy to clipboard operation
atom-languageclient copied to clipboard

LSP not working when file opened by fuzzy finder

Open extraymond opened this issue 7 years ago • 8 comments

Environment Linux x64 ubuntu 16.04

Atom version 1.24.0.beta3, 1.23.1

Encountered situation

Greetings, I've encountered a weird behaviour.

If I open a file from the project file tree, python language server is working properly. But if the file is opened by ctrl-p (opens fuzzy file finder), the linter and all the ide stuff is not working.

extraymond avatar Jan 14 '18 16:01 extraymond

Thanks for the report! I was unable to reproduce on Ubuntu 16.04 and Atom 1.24.0-beta3. I just used this file with a syntax error:

print("Hello Word!"

And when I open it with fuzzy finder, the error is reported in diagnostics. Can you reproduce with this simple example?

rsese avatar Jan 17 '18 02:01 rsese

Oh also, are you using https://github.com/lgeiger/ide-python? That's what I installed to test.

rsese avatar Jan 17 '18 02:01 rsese

Yes! That's the one I'm using. Here's the gif:

As you can see, if I open file with fuzzy select, the ide is idling.

atom

However, I've found that files opened with fuzzy selector will have the full path in the tab label. In this case, since my project folder is inside another partition and linked to my home folder, I'm not sure if that's the symptom here.

2018-01-17 19-58-35

extraymond avatar Jan 17 '18 11:01 extraymond

However, I've found that files opened with fuzzy selector will have the full path in the tab label. In this case, since my project folder is inside another partition and linked to my home folder, I'm not sure if that's the symptom here.

If you copy the project to your home folder, can you still reproduce?

Also, do you notice any errors in devtools console?

rsese avatar Jan 17 '18 21:01 rsese

We only fire up the language server if the file you open is contained within the folder you have added to atom.

The nature of the LSP protocol requires that a language server is started in the folder above - if we allowed random files to be opened this way we'd have no direct way of knowing where the project folder is (we'd have to recurse up looking for clues) plus opening 5-6 random files could result in 5-6 language servers.

damieng avatar Jan 17 '18 22:01 damieng

@rsese

Thx, If I add the project folder from the original directory, LSP works.

@damieng

Thx for clarifying! I agree that LSP should only be fired up in the given circumstances.

But since symlink is a very frequently used feature under UNIX workflow, if I add a project folder(in this case a symlink) to atom, I would expect atom to treat it like I'm adding the root to atom.

I've found settings related to symlink in atom settings, but no combination(Natimve/Emulation x Accept(symlink)) works.

Is LSP talks directly to file systems or via atom? If latter is the case I guess it's possible to fire-up LSP after atom confirms the location from symlink to root folder.

extraymond avatar Jan 18 '18 11:01 extraymond

So you're adding a symlink then opening files from within it? If so, yes I agree that should work.

I suspect though the problem is how Atom is dealing internally with the file names given the tab also has absolute paths.

damieng avatar Jan 18 '18 16:01 damieng

Development of atom-languageclient has officially moved to https://github.com/atom-ide-community/atom-languageclient 🎉

If this is still an issue please consider opening an issue on that repo.

UziTech avatar Oct 19 '20 19:10 UziTech