Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
- name: Restore tools
run: dotnet tool restore

- name: Run Fantomas check
run: dotnet fantomas --check .

- name: Run Build
run: dotnet build

- name: Run Tests
run: dotnet test --no-build

- name: Run Fantomas check
run: dotnet fantomas --check .
15 changes: 3 additions & 12 deletions tests/CSharpLanguageServer.Tests/Tooling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ let makeServerProcessInfo projectTempDir =

processStartInfo


type ClientServerRpcRequestInfo =
{ Method: string
RpcRequestMsg: JObject
Expand Down Expand Up @@ -526,7 +525,6 @@ let processClientEvent (state: ClientState) (post: ClientEvent -> unit) msg : As
return state
}


let clientEventLoop (initialState: ClientState) (inbox: MailboxProcessor<ClientEvent>) =
let rec loop state = async {
let! msg = inbox.Receive()
Expand All @@ -542,7 +540,6 @@ let clientEventLoop (initialState: ClientState) (inbox: MailboxProcessor<ClientE
raise ex
}


let prepareTempTestDirFrom (sourceTestDir: DirectoryInfo) : string =
if not sourceTestDir.Exists then
failwith (sprintf "%s does not exist!" (sourceTestDir.ToString()))
Expand Down Expand Up @@ -590,7 +587,6 @@ let prepareTempTestDirFrom (sourceTestDir: DirectoryInfo) : string =

copyDirWithFilter sourceTestDir tempTestDir |> string


let rec deleteDirectory (path: string) =
if Directory.Exists(path) then
Directory.GetFileSystemEntries(path)
Expand All @@ -602,7 +598,6 @@ let rec deleteDirectory (path: string) =

Directory.Delete(path)


type FileController
(client: MailboxProcessor<ClientEvent>, projectDir: string, filename: string, fixtureIsReadOnly: bool) =
let mutable fileContents: option<string> = None
Expand All @@ -614,7 +609,6 @@ type FileController
| PlatformID.Win32NT -> ("file:///" + projectDir + "/" + filename).Replace("\\", "/")
| _ -> "file://" + projectDir + "/" + filename


interface IDisposable with
member this.Dispose() =
let didCloseParams: DidCloseTextDocumentParams =
Expand Down Expand Up @@ -669,7 +663,6 @@ type FileController

tes |> Array.rev |> Array.fold applyTextEdit fileContents.Value


type ClientController(client: MailboxProcessor<ClientEvent>, fixtureName: string, fixtureIsReadOnly: bool) =
let mutable projectDir: string option = None
let mutable solutionLoaded: bool = false
Expand Down Expand Up @@ -727,9 +720,11 @@ type ClientController(client: MailboxProcessor<ClientEvent>, fixtureName: string
let state = client.PostAndReply(fun rc -> ServerStartRequest(projectDir.Value, rc))

let initializeParams: InitializeParams =
let rootUri = Uri(projectDir.Value) |> string |> DocumentUri

{ RootPath = None
RootUri = Some rootUri
ProcessId = (Process.GetCurrentProcess().Id) |> int |> Some
RootUri = (sprintf "file://%s" projectDir.Value) |> Some
Capabilities = state.ClientProfile.ClientCapabilities
WorkDoneToken = None
ClientInfo = None
Expand Down Expand Up @@ -876,7 +871,6 @@ type ClientController(client: MailboxProcessor<ClientEvent>, fixtureName: string
file.Open()
file


let private activateClient (clientProfile: ClientProfile) (fixtureName: string) (readOnlyFixture: bool) =
let initialState =
{ defaultClientState with
Expand All @@ -888,11 +882,9 @@ let private activateClient (clientProfile: ClientProfile) (fixtureName: string)
client.StartAndWaitForSolutionLoad(clientProfile)
client


let activeClientsSemaphore =
new SemaphoreSlim(Environment.ProcessorCount, Environment.ProcessorCount)


let activateFixture fixtureName =
activeClientsSemaphore.Wait()

Expand All @@ -901,7 +893,6 @@ let activateFixture fixtureName =
finally
activeClientsSemaphore.Release() |> ignore


module TextEdit =
let normalizeNewText (s: TextEdit) =
{ s with
Expand Down