Skip to content

Commit

Permalink
Fix Tests for AdaptiveLspServer (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Feb 19, 2023
1 parent fdeca2f commit fe598dd
Show file tree
Hide file tree
Showing 37 changed files with 609 additions and 208 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Expand Up @@ -10,6 +10,7 @@ jobs:
build:
env:
TEST_TIMEOUT_MINUTES: 30
FSAC_TEST_DEFAULT_TIMEOUT : 120000 #ms, individual test timeouts
timeout-minutes: 30 # we have a locking issue, so cap the runs at ~20m to account for varying build times, etc
strategy:
matrix:
Expand Down
54 changes: 20 additions & 34 deletions paket.lock

Large diffs are not rendered by default.

55 changes: 29 additions & 26 deletions src/FsAutoComplete.Core/Commands.fs
Expand Up @@ -88,6 +88,7 @@ type NotificationEvent =
| TestDetected of file: string<LocalPath> * tests: TestAdapter.TestAdapterEntry<range>[]

module Commands =
open System.Collections.Concurrent
let fantomasLogger = LogProvider.getLoggerByName "Fantomas"
let commandsLogger = LogProvider.getLoggerByName "Commands"

Expand Down Expand Up @@ -836,7 +837,7 @@ module Commands =
return Choice1Of2(declarationRanges, usageRanges)

| SymbolDeclarationLocation.Projects (projects, isInternalToProject) ->
let symbolUseRanges = ImmutableArray.CreateBuilder()
let symbolUseRanges = ConcurrentBag<_>()
let symbolRange = symbol.DefinitionRange.NormalizeDriveLetterCasing()
let symbolFile = symbolRange.TaggedFileName

Expand Down Expand Up @@ -967,30 +968,6 @@ module Commands =
highlights |> Array.collect expandParents)
|> Array.sortBy startToken

type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: bool, rootPath: string option) =
let fileParsed = Event<FSharpParseFileResults>()

let fileChecked = Event<ParseAndCheckResults * string<LocalPath> * int>()

let scriptFileProjectOptions = Event<FSharpProjectOptions>()

let disposables = ResizeArray()

let mutable workspaceRoot: string option = rootPath
let mutable linterConfigFileRelativePath: string option = None
// let mutable linterConfiguration: FSharpLint.Application.Lint.ConfigurationParam = FSharpLint.Application.Lint.ConfigurationParam.Default
let mutable lastCheckResult: ParseAndCheckResults option = None

let notify = Event<NotificationEvent>()

let fileStateSet = Event<unit>()
let commandsLogger = LogProvider.getLoggerByName "Commands"

let checkerLogger = LogProvider.getLoggerByName "CheckerEvents"

let fantomasLogger = LogProvider.getLoggerByName "Fantomas"




let analyzerHandler (file: string<LocalPath>, content, pt, tast, symbols, getAllEnts) =
Expand Down Expand Up @@ -1038,6 +1015,32 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers:

[||]


type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: bool, rootPath: string option) =
let fileParsed = Event<FSharpParseFileResults>()

let fileChecked = Event<ParseAndCheckResults * string<LocalPath> * int>()

let scriptFileProjectOptions = Event<FSharpProjectOptions>()

let disposables = ResizeArray()

let mutable workspaceRoot: string option = rootPath
let mutable linterConfigFileRelativePath: string option = None
// let mutable linterConfiguration: FSharpLint.Application.Lint.ConfigurationParam = FSharpLint.Application.Lint.ConfigurationParam.Default
let mutable lastCheckResult: ParseAndCheckResults option = None

let notify = Event<NotificationEvent>()

let fileStateSet = Event<unit>()
let commandsLogger = LogProvider.getLoggerByName "Commands"

let checkerLogger = LogProvider.getLoggerByName "CheckerEvents"

let fantomasLogger = LogProvider.getLoggerByName "Fantomas"



do
disposables.Add
<| state.ProjectController.Notifications.Subscribe(NotificationEvent.Workspace >> notify.Trigger)
Expand Down Expand Up @@ -1105,7 +1108,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers:
| true, fileData ->

let res =
analyzerHandler (
Commands.analyzerHandler (
file,
fileData.Lines.ToString().Split("\n"),
parseAndCheck.GetParseResults.ParseTree,
Expand Down
10 changes: 10 additions & 0 deletions src/FsAutoComplete.Core/Consts.fs
@@ -0,0 +1,10 @@
namespace FsAutoComplete.Core

module ProjectLoader =
[<Literal>]
let ProduceReferenceAssembly = "ProduceReferenceAssembly"

let globalProperties =
[
// For tooling we don't want to use Reference Assemblies as this doesn't play well with type checking across projects
ProduceReferenceAssembly, "false" ]
3 changes: 2 additions & 1 deletion src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj
Expand Up @@ -9,6 +9,7 @@
<TrimmerRootAssembly Include="FsAutoComplete.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Consts.fs" />
<Compile Include="Workaround/ServiceParseTreeWalk.fs" />
<Compile Include="Debug.fs" />
<Compile Include="Utils.fs" />
Expand Down Expand Up @@ -45,4 +46,4 @@
<Compile Include="Commands.fs" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
</Project>

0 comments on commit fe598dd

Please sign in to comment.