omnisharp-server icon indicating copy to clipboard operation
omnisharp-server copied to clipboard

Enable working with more than one solution at a time.

Open markwoodhall opened this issue 10 years ago • 5 comments

Currently OmniSharp server is limited to working with just one active solution. It would be useful if it could be enhanced to support multiple solutions.

I'm not sure exactly how this would be achieved but I think it makes sense for the server to handle it and not the client, I could be wrong though.

It could well be that handling multiple solutions is not required, maybe OmniSharp server could work without a solution at all and instead scan a directory. I'm not sure.

Whatever the solution it would be great to be able to have various instances of an OmniSharp client (in my case the vim plugin) get auto completion and project/reference management.

I'd be happy to have a go at this and send a pull request but I'd like to get opinions first and make sure it fits with other development that may be ongoing.

markwoodhall avatar Nov 08 '14 15:11 markwoodhall

OmniSharp can already work by scanning a folder. You can just pass a folder in to the -s parameter instead of a solution file. It loads all the cs files and all dlls that it finds. It's not ideal though... project references etc. don't work that way.

So the way that I think it should work is that you should be able to start OmniSharp without specifying any sln or project file at all (but the current method should still work). The server should traverse upwards until it finds an sln file or a project.json file. We discussed this a little here https://github.com/OmniSharp/omnisharp-server/issues/81. I'm not sure what should happen if 2 solutions are found in the same folder, although I think a fairly reasonable solution would be to have a list of 'preferred solutions' in the config.

A dictionary should be maintained of <CSharpFile, Project>. For each request, if there isn't a known project for the current cs file, we do the directory traversal mentioned above to load the solution which would add to the above dictionary. We should probably have some kind of timeout to unload solutions that haven't been touched in some configurable amount of time.

Having said that.... this area of code is particularly gnarly and untested. I've already started to look at using this library since it recently got support for mono https://github.com/tathamoddie/System.IO.Abstractions to help make the code more testable. Another thing to consider is that I want to get good support for vnext projects in very shortly (next few days)

nosami avatar Nov 08 '14 20:11 nosami

I didn't realise you can start it and get it to scan a folder, I think that would probably help me a fair bit at the moment so that is useful to know.

Do you think its worth holding fire on doing anything until you've made changes to handle vNext projects.

markwoodhall avatar Nov 08 '14 23:11 markwoodhall

Yeah.. probably. I think the code is in quite a state and is going to need a lot of refactoring.

nosami avatar Nov 08 '14 23:11 nosami

Ok, I'll hold fire. I'm eager to contribute something though, I feel like OmniSharp has been awesome for me.

markwoodhall avatar Nov 08 '14 23:11 markwoodhall

:+1:

nosami avatar Nov 09 '14 00:11 nosami