-
Notifications
You must be signed in to change notification settings - Fork 169
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
WIP: Improve sln scope handling #711
base: master
Are you sure you want to change the base?
Conversation
Hi @Melandel, Can you give an example of a folder/solution structure where this works differently to the current behaviour? Or is this about performance benefits, not changing behaviour? |
Sure.
After starting vimie, no omnisharp server running.
I'm not changing this behavior. After
|
sln_or_dir == sln1.sln |
sln_or_dir == sln2.sln |
sln_or_dir == sln3.sln |
|
---|---|---|---|
Equality is true for files inside... | module1 module2 |
module3 module4 |
module5 module6 |
Pain point
I don't have access to the intellisense from a file inside module3
or module5
, despite the fact that they are referenced by sln1
After the PR
sln_or_dir == sln1.sln |
sln_or_dir == sln2.sln |
sln_or_dir == sln3.sln |
|
---|---|---|---|
files inside... | module1 module2 module3 module5 |
module4 |
module6 |
Value
I have access to the intellisense from a file inside any module that is referenced by sln1
2ce53e4
to
246c105
Compare
I'm not sure about this last commit.
It seems like this last commit will close What about situations where you are working in |
OK I've been thinking about it a bit more and I think that, while it should be possible to do what you're doing here, I don't think it should be default behaviour. Having buffers change from one solution to another may not fit with other users' expectations. How about this. We keep the changes that have been made to " autoload/OmniSharp/actions/workspace.vim line 33
if exists('g:OmniSharp_server_loaded_callback')
call function(g:OmniSharp_server_loaded_callback, [a:job])
endif
endfunction Then in a user config, I could do this: " .vimrc
let g:OmniSharp_server_loaded_callback = 'OnSolutionLoaded'
function! OnSolutionLoaded(job)
echmsg 'Solution ' . a:job.sln_or_dir . ' loaded, with ' . len(a:job.projects) . 'projects'
endfunction And you could implement the What do you think? |
…ered by newly started job. Use g:OmniSharp_stop_redundant_servers to change that default behavior
37fa24e
to
222721c
Compare
…ervers enabled by default
…ck another server to handle the current file
…wn function: mapnew
I've tried out the latest commits and immediately hit 2 issues. The first is a breaking behavioural change which is incorrect. I have a project structure like this:
Each solution is distinct - main.sln does not include test.csproj. I open a file under main.csproj which launches main.sln, as expected. I then open a file under test.csproj. This is associated with main.sln and doesn not start a new OmniSharp-roslyn server for test.sln, which it should. The second issue is a bug, causing a vim error. I opened a fresh vim, and opened a file under test.csproj, which loaded test.sln. I then opened a file under main.csproj, which loaded main.sln. This matches current behaviour and was expected. I went back to the test file which now should have 2 available running servers it can switch between. I entered
I have also struck similar errors when loading 2 servers simultaneously. I also note that you have replaced My conclusion at this point is to come back to my previous comment: I think it's good to be able to manage this stuff programatically and OmniSharp-vim should provide open APIs and callbacks to allow coding up custom workflows, but I still think a lot of this behaviour is too niche and workflow-specific to be included as standard behaviour. I like Having said that, it is again probably quite niche behaviour. How many people will use it, or even learn that this behaviour exists? |
I personally had issues with
My understanding is that in this PR, we use all the running servers except the one in If your assumption is correct ( |
I apologise, no I was using an over-simplified example to explain the scenario. Here is a "real" version of what I was describing: mkdir main
dotnet new sln
dotnet new classlib -n main
dotnet sln add main
dotnet new mstest -n test
dotnet new sln -n test -o test
dotnet sln test add test/test.csproj I can now build main with
Now, 2 scenarios.
In scenario 1, this demonstrates a breaking change from current OmniSharp-vim behaviour - currently Also, when I run scenario 2 quickly, opening
Now, we can add the test project to dotnet sln add test/test.csproj Scenario 1 from above works the same. Note though that I would expect to be able to use Re-running scenario 2,
8.2.3516 - I built it on Friday. The error occurs when using
Yes I currently do this too, I
My point is that, because the server in I think the completion function should be simplified to just include all running solutions, |
Given a server was requested to start
When the projects are done loading
Then any existing buffer whose path is under one of the projects should be associated with the server
Given a server was running
When a new buffer is edited
Then omnisharp should try to associate it with a running server before trying to find a potential sln_or_dir in its parent folders