Skip to content
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

P2p references #3777

Merged
merged 10 commits into from
Oct 24, 2017
16 changes: 9 additions & 7 deletions src/fsharp/vs/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ type FSharpParsingOptions =
}

static member FromTcConfigBuidler(tcConfigB: TcConfigBuilder, sourceFiles) =
{
{
SourceFiles = sourceFiles
ConditionalCompilationDefines = tcConfigB.conditionalCompilationDefines
ErrorSeverityOptions = tcConfigB.errorSeverityOptions
Expand Down Expand Up @@ -1725,7 +1725,7 @@ type FSharpProjectOptions =
member x.ProjectOptions = x.OtherOptions
/// Whether the two parse options refer to the same project.
static member UseSameProjectFileName(options1,options2) =
options1.ProjectFileName = options2.ProjectFileName
options1.ProjectFileName = options2.ProjectFileName

/// Compare two options sets with respect to the parts of the options that are important to building.
static member AreSameForChecking(options1,options2) =
Expand All @@ -1738,7 +1738,9 @@ type FSharpProjectOptions =
options1.UnresolvedReferences = options2.UnresolvedReferences &&
options1.OriginalLoadReferences = options2.OriginalLoadReferences &&
options1.ReferencedProjects.Length = options2.ReferencedProjects.Length &&
Array.forall2 (fun (n1,a) (n2,b) -> n1 = n2 && FSharpProjectOptions.AreSameForChecking(a,b)) options1.ReferencedProjects options2.ReferencedProjects &&
Array.forall2 (fun (n1,a) (n2,b) ->
n1 = n2 &&
FSharpProjectOptions.AreSameForChecking(a,b)) options1.ReferencedProjects options2.ReferencedProjects &&
options1.LoadTime = options2.LoadTime

/// Compute the project directory.
Expand Down Expand Up @@ -2050,11 +2052,11 @@ module Helpers =

// Look for DLLs in the location of the service DLL first.
let defaultFSharpBinariesDir = FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(Some(typeof<FSharpCheckFileAnswer>.Assembly.Location)).Value

/// Determine whether two (fileName,options) keys are identical w.r.t. affect on checking
let AreSameForChecking2((fileName1: string, options1: FSharpProjectOptions), (fileName2, o2)) =
let AreSameForChecking2((fileName1: string, options1: FSharpProjectOptions), (fileName2, options2)) =
(fileName1 = fileName2)
&& FSharpProjectOptions.AreSameForChecking(options1,o2)
&& FSharpProjectOptions.AreSameForChecking(options1,options2)

/// Determine whether two (fileName,options) keys should be identical w.r.t. resource usage
let AreSubsumable2((fileName1:string,o1:FSharpProjectOptions),(fileName2:string,o2:FSharpProjectOptions)) =
Expand Down Expand Up @@ -2720,7 +2722,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
member bc.InvalidateConfiguration(options : FSharpProjectOptions, startBackgroundCompileIfAlreadySeen, userOpName) =
let startBackgroundCompileIfAlreadySeen = defaultArg startBackgroundCompileIfAlreadySeen implicitlyStartBackgroundWork
// This operation can't currently be cancelled nor awaited
reactor.EnqueueOp(userOpName, "InvalidateConfiguration", options.ProjectFileName, fun ctok ->
reactor.EnqueueOp(userOpName, "InvalidateConfiguration: Stamp(" + (options.Stamp |> Option.defaultValue 0L).ToString() + ")", options.ProjectFileName, fun ctok ->
// If there was a similar entry then re-establish an empty builder . This is a somewhat arbitrary choice - it
// will have the effect of releasing memory associated with the previous builder, but costs some time.
if incrementalBuildersCache.ContainsSimilarKey (ctok, options) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type internal FSharpColorizationService
asyncMaybe {
do Trace.TraceInformation("{0:n3} (start) SemanticColorization", DateTime.Now.TimeOfDay.TotalSeconds)
do! Async.Sleep DefaultTuning.SemanticColorizationInitialDelay |> liftAsync // be less intrusive, give other work priority most of the time
let! _parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForDocumentOrProject(document)
let! _, _, projectOptions = projectInfoManager.TryGetOptionsForDocumentOrProject(document)
let! sourceText = document.GetTextAsync(cancellationToken)
let! _, _, checkResults = checkerProvider.Checker.ParseAndCheckDocument(document, projectOptions, sourceText = sourceText, allowStaleResults = false, userOpName=userOpName)
// it's crucial to not return duplicated or overlapping `ClassifiedSpan`s because Find Usages service crashes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type internal FSharpDocumentDiagnosticAnalyzer() =
override this.AnalyzeSemanticsAsync(document: Document, cancellationToken: CancellationToken): Task<ImmutableArray<Diagnostic>> =
let projectInfoManager = getProjectInfoManager document
asyncMaybe {
let! parsingOptions, projectOptions = projectInfoManager.TryGetOptionsForDocumentOrProject(document)
let! parsingOptions, _, projectOptions = projectInfoManager.TryGetOptionsForDocumentOrProject(document)
let! sourceText = document.GetTextAsync(cancellationToken)
let! textVersion = document.GetTextVersionAsync(cancellationToken)
return!
Expand Down
Loading