OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
512 stars 94 forks source link

Doesn't find solution file in parent directory when opened from symbolic link directory #498

Closed Sgregory42 closed 4 years ago

Sgregory42 commented 4 years ago

Hello,

I have a unity project that has symbolic link directory for the scripts. eg : /projectRoot/myproject.sln /projectRoot/../../Scripts -> /randomRoot/../../Scripts/{bunch_of_script}.cs

If I open one of the file located in Scripts, it will run omnisharp and I believe it tries to find the Solution file in the current direcotry but since it doesn't find, it goes up directory.

Problem is that it goes back from /randomRoot/../../src/{bunch_of_script}.cs and obviously doesn't find the solution file located in /projectRoot/myproject.sln

I've read that omnisharp should ask me where the solution file when starting it but it doesn't I also couldn't find a function to force load a certain solution project.

Any help/pointer would be appreciated, thanks !

Using spacemacs emacs version : 26.3 omnisharp version : 1.34.2

razzmatazz commented 4 years ago

Hey @Sgregory42 . You should try running the "start server" function with the universal argument set:

This should prompt you for directory to use for omnisharp project root.

(Make sure you stop the served beforehand with M-x omnisharp-stop-server if you have a server running already as omnisharp does not support multiple servers running at the same time)

Sgregory42 commented 4 years ago

Thanks for you fast response, I forgot to mention that I already tried omnisharp-start-omnisharp-server but it doesn't prompt me for a directory.

It still automatically loads /randomRoot as project root.

What are the condition for omnisharp to think that it's a project root ? Having dotsln file ?

I don't think I have seen any solution file in that folder, but I'll cross check this evening.

razzmatazz commented 4 years ago

omnisharp-emacs uses projectile (if available) -- which in its part usually takes the root of your SCM (git/svn) repository as project root. Otherwise omnisharp-emacs defaults to the directory of your current buffer.

Sgregory42 commented 4 years ago

Thanks for your help, the issue was with projectile not handling symbolic links.

I found a workaround : https://github.com/bbatsov/projectile/pull/970#issuecomment-231571437