Skip to content

Commit bb1b68e

Browse files
committed
Extract solution functions to CSharpLanguageServer.Roslyn.Solution
1 parent 70d241f commit bb1b68e

File tree

10 files changed

+463
-436
lines changed

10 files changed

+463
-436
lines changed

src/CSharpLanguageServer/CSharpLanguageServer.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<Compile Include="FormatUtil.fs" />
2929
<Compile Include="ProgressReporter.fs" />
3030
<Compile Include="Roslyn/WorkspaceServices.fs" />
31+
<Compile Include="Roslyn/Solution.fs" />
3132
<Compile Include="RoslynHelpers.fs" />
3233
<Compile Include="DocumentationUtil.fs" />
3334
<Compile Include="Diagnostics.fs" />

src/CSharpLanguageServer/Diagnostics.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ open Ionide.LanguageServerProtocol.JsonRpc
88

99
open CSharpLanguageServer.Types
1010
open CSharpLanguageServer.Logging
11-
open CSharpLanguageServer.RoslynHelpers
11+
open CSharpLanguageServer.Roslyn.Solution
1212

1313
module Diagnostics =
1414
let private logger = Logging.getLoggerByName "Diagnostics"
@@ -58,13 +58,13 @@ module Diagnostics =
5858
let diagnose (settings: ServerSettings) : Async<int> = async {
5959
logger.LogDebug("diagnose: settings={settings}", settings)
6060

61-
initializeMSBuild logger
61+
initializeMSBuild ()
6262

6363
logger.LogDebug("diagnose: loading solution..")
6464

6565
let lspClient = new LspClientStub()
6666
let cwd = string (Directory.GetCurrentDirectory())
67-
let! _sln = loadSolutionOnSolutionPathOrDir lspClient logger None cwd
67+
let! _sln = solutionLoadSolutionWithPathOrOnCwd lspClient None cwd
6868

6969
logger.LogDebug("diagnose: done")
7070

src/CSharpLanguageServer/Handlers/Initialization.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ open CSharpLanguageServer.State
1414
open CSharpLanguageServer.State.ServerState
1515
open CSharpLanguageServer.Types
1616
open CSharpLanguageServer.Logging
17-
open CSharpLanguageServer.RoslynHelpers
17+
open CSharpLanguageServer.Roslyn.Solution
18+
1819

1920
[<RequireQualifiedAccess>]
2021
module Initialization =
@@ -53,7 +54,7 @@ module Initialization =
5354
serverName
5455
)
5556

56-
initializeMSBuild logger
57+
initializeMSBuild ()
5758

5859
logger.LogDebug("handleInitialize: p.Capabilities={caps}", serialize p.Capabilities)
5960
context.Emit(ClientCapabilityChange p.Capabilities)

src/CSharpLanguageServer/Handlers/TextDocumentSync.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open CSharpLanguageServer.Conversions
1111
open CSharpLanguageServer.State
1212
open CSharpLanguageServer.State.ServerState
1313
open CSharpLanguageServer.RoslynHelpers
14+
open CSharpLanguageServer.Roslyn.Solution
1415
open CSharpLanguageServer.Logging
1516

1617
[<RequireQualifiedAccess>]
@@ -66,7 +67,7 @@ module TextDocumentSync =
6667
match docFilePathMaybe with
6768
| Some docFilePath -> async {
6869
// ok, this document is not in solution, register a new document
69-
let! newDocMaybe = tryAddDocument logger docFilePath openParams.TextDocument.Text context.Solution
70+
let! newDocMaybe = solutionTryAddDocument docFilePath openParams.TextDocument.Text context.Solution
7071

7172
match newDocMaybe with
7273
| Some newDoc ->
@@ -130,7 +131,7 @@ module TextDocumentSync =
130131

131132
| None -> async {
132133
let docFilePath = Util.parseFileUri saveParams.TextDocument.Uri
133-
let! newDocMaybe = tryAddDocument logger docFilePath saveParams.Text.Value context.Solution
134+
let! newDocMaybe = solutionTryAddDocument docFilePath saveParams.Text.Value context.Solution
134135

135136
match newDocMaybe with
136137
| Some newDoc ->

src/CSharpLanguageServer/Handlers/Workspace.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ open CSharpLanguageServer
1212
open CSharpLanguageServer.State
1313
open CSharpLanguageServer.State.ServerState
1414
open CSharpLanguageServer.RoslynHelpers
15+
open CSharpLanguageServer.Roslyn.Solution
1516
open CSharpLanguageServer.Logging
1617
open CSharpLanguageServer.Types
1718

@@ -61,7 +62,7 @@ module Workspace =
6162
| Some docFilePath ->
6263
// ok, this document is not on solution, register a new one
6364
let fileText = docFilePath |> File.ReadAllText
64-
let! newDocMaybe = tryAddDocument logger docFilePath fileText context.Solution
65+
let! newDocMaybe = solutionTryAddDocument docFilePath fileText context.Solution
6566

6667
match newDocMaybe with
6768
| Some newDoc -> context.Emit(SolutionChange newDoc.Project.Solution)

0 commit comments

Comments
 (0)