-
Notifications
You must be signed in to change notification settings - Fork 156
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
Adopt workspaceFolders
#733
Comments
Note that I'm not actually suggesting supporting multiple roots in FSAC, but just altering our initialization routines to handle them, eventually deciding upon the one root. |
From reading |
Ok, taking a look at this today and summarizing some thoughts. Today our behavior in a multi-workspace scenario is very bad - we only look inside the first workspace, which often can not even be .NET code. When a workspace is defined (either anonymous or loaded from a saved workspaces config file), the LSP server is still initialized via only a single "workspaceFolders": [
{
"uri": "file:///e%3A/Code/FsAutoComplete",
"name": "FsAutoComplete"
},
{
"uri": "file:///e%3A/Code/ionide-vscode-fsharp",
"name": "ionide-vscode-fsharp"
}
] in addition, the "rootPath": "e:\\Code\\FsAutoComplete",
"rootUri": "file:///e%3A/Code/FsAutoComplete", I think we have three modes to think about here: No workspaceThis appears as a single workspace in the initialize, so we can consider these two the same Single workspaceWe can update FSAC's initialize handler and config update handler(s) our code to use the single workspace that is present as the 'root'. Similarly, Ionide's custom logic for inferring a root should do the same. Multi-workspaceIn this case we have two scenarios to think about - one in which only a single workspace has a solution file or F# code, and one in which multiple workspaces have a solution file or F# code. Single sub-workspace has F# codeIn this case we can continue as normal - we can have the workspacePeek and FSAC AutomaticInit routines probe each workspace root, discard the ones that have no interesting solution files or projects, and if only one workspace has any interesting items we can treat that workspace as the inferred root from that point onwards Multiple sub-workspaces have F# codeIn this case we have some complications to consider. I am interested in two main touch-points:
For For inferring a @TheAngryByrd / @Krzysztof-Cieslak, do you have any thoughts or commentary on this? Right now my inclination is to go the multiple-AdaptiveServerState-instances route. |
I agree. I think it makes sense have a |
Per ionide/ionide-vscode-fsharp#1204 we should move off of using rootPath/rootUri directly.
Updated thoughts
We should do this, but it's a large task so we will take it in stages:
Stage 1 - remove use of deprecated members, keep behavior the same as today
RootPath
/RootUri
directly, in favor of theworkspacePaths[0].Uri
- this should be functionally the same as today, but stop our use of the deprecated membersStage 2 - allow FSAC to handle not being the first workspacePath
workspacePaths
for the firstworkspacePath
with F# code in it and then fixate on that one - this keeps us in the 'single workspace' mode but enables users with many other workspaces to start working with usStage 3 - update FSAC to support multiple workspaces, with
AdaptiveServerState
s per workspaceAdaptiveServerState
instances per workspace rootFirst version of this description
Here's some initial investigation:I've been looking at handling workspaceFolders (omnisharp has a not-completely-terrible thing that helped me get an idea for how it could be done), but it's completely going to up-end the initialization assumptions we've made so far. A brief explanation is in order. Right now, there
are three primary initialization flows, all of which I call the single folder model:
manual-init
in this model, the call stack looks like:
at this point the projects load, the user can do interactions as normal
automatic-init-single-interesting
in this model, the call stack looks like:
at this point the projects load, the user can do interactions as normal
automatic-init-multiple-interesting
in this model, the call stack looks like:
In all of these cases, the intialize payload has a RootPath/RootUri, and there's a block of F#-specific settings under the FSharp property key. We set a rootpath in the Commands at this point, and we eventually set the workspaceRoot (some mutable state) in the LSP itself.
multi-workspace
In a multi-workspace situation, none of that holds. The callstack looks like the following:
This means that we need to extract out the actual initialization code from the initialize call and conditionally apply it, as well as likely listen to workspaceChanged events to set the workspace root.
The text was updated successfully, but these errors were encountered: