Skip to content

Commit 63e37e3

Browse files
authored
Fix quickinfo text (#17682)
* Fix quickinfo text * realsig and globals * fantomas * oops * fantomas
1 parent bbd54d1 commit 63e37e3

File tree

8 files changed

+70
-15
lines changed

8 files changed

+70
-15
lines changed

eng/Build.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ param (
6464
[switch]$testAllButIntegrationAndAot,
6565
[switch]$testpack,
6666
[switch]$testAOT,
67+
[switch]$testEditor,
6768
[switch]$testBenchmarks,
6869
[string]$officialSkipTests = "false",
6970
[switch]$noVisualStudio,
@@ -119,6 +120,7 @@ function Print-Usage() {
119120
Write-Host " -testVs Run F# editor unit tests"
120121
Write-Host " -testpack Verify built packages"
121122
Write-Host " -testAOT Run AOT/Trimming tests"
123+
Write-Host " -testEditor Run VS Editor tests"
122124
Write-Host " -testBenchmarks Build and Run Benchmark suite"
123125
Write-Host " -officialSkipTests <bool> Set to 'true' to skip running tests"
124126
Write-Host ""
@@ -178,7 +180,11 @@ function Process-Arguments() {
178180
$script:testFSharpQA = $True
179181
$script:testIntegration = $False
180182
$script:testVs = $True
181-
$script:testAOT = $False
183+
$script:testEditor = $True
184+
}
185+
186+
if($script:testVs) {
187+
$script:testEditor = $True
182188
}
183189

184190
if ([System.Boolean]::Parse($script:officialSkipTests)) {
@@ -669,11 +675,15 @@ try {
669675
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
670676
}
671677

672-
if ($testVs -and -not $noVisualStudio) {
678+
if ($testEditor -and -not $noVisualStudio) {
673679
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj"
680+
}
681+
682+
if ($testVs -and -not $noVisualStudio) {
674683
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\"
675684
}
676685

686+
677687
if ($testIntegration) {
678688
TestUsingMSBuild -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\"
679689
}

src/Compiler/Service/IncrementalBuild.fs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,33 @@ type FrameworkImportsCache(size) =
554554
let frameworkDLLs, nonFrameworkResolutions, unresolved = TcAssemblyResolutions.SplitNonFoundationalResolutions(tcConfig)
555555
let node = this.GetNode(tcConfig, frameworkDLLs, nonFrameworkResolutions)
556556
let! tcGlobals, frameworkTcImports = node.GetOrComputeValue()
557+
558+
// If the tcGlobals was loaded from a different project, langVersion and realsig may be different
559+
// for each cached project. So here we create a new tcGlobals, with the existing framework values
560+
// and updated realsig and langversion
561+
let tcGlobals =
562+
if tcGlobals.langVersion.SpecifiedVersion <> tcConfig.langVersion.SpecifiedVersion
563+
|| tcGlobals.realsig <> tcConfig.realsig then
564+
TcGlobals(
565+
tcGlobals.compilingFSharpCore,
566+
tcGlobals.ilg,
567+
tcGlobals.fslibCcu,
568+
tcGlobals.directoryToResolveRelativePaths,
569+
tcGlobals.mlCompatibility,
570+
tcGlobals.isInteractive,
571+
tcGlobals.checkNullness,
572+
tcGlobals.useReflectionFreeCodeGen,
573+
tcGlobals.tryFindSysTypeCcuHelper,
574+
tcGlobals.emitDebugInfoInQuotations,
575+
tcGlobals.noDebugAttributes,
576+
tcGlobals.pathMap,
577+
tcConfig.langVersion,
578+
tcConfig.realsig
579+
)
580+
581+
else
582+
tcGlobals
583+
557584
return tcGlobals, frameworkTcImports, nonFrameworkResolutions, unresolved
558585
}
559586

@@ -1445,6 +1472,8 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc
14451472

14461473
tcConfigB.useSimpleResolution <- (getSwitchValue useSimpleResolutionSwitch) |> Option.isSome
14471474

1475+
tcConfigB.realsig <- List.contains "--realsig" commandLineArgs || List.contains "--realsig+" commandLineArgs
1476+
14481477
// Apply command-line arguments and collect more source files if they are in the arguments
14491478
let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, commandLineArgs)
14501479

src/Compiler/Service/TransparentCompiler.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,10 @@ type internal TransparentCompiler
793793

794794
define :: tcConfigB.conditionalDefines
795795

796+
tcConfigB.realsig <-
797+
List.contains "--realsig" commandLineArgs
798+
|| List.contains "--realsig+" commandLineArgs
799+
796800
tcConfigB.projectReferences <- projectReferences
797801

798802
tcConfigB.useSimpleResolution <- useSimpleResolution

src/Compiler/Service/service.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,8 @@ type FSharpChecker
641641
if isEditing then
642642
tcConfigB.conditionalDefines <- "EDITING" :: tcConfigB.conditionalDefines
643643

644+
tcConfigB.realsig <- List.contains "--realsig" argv || List.contains "--realsig+" argv
645+
644646
// Apply command-line arguments and collect more source files if they are in the arguments
645647
let sourceFilesNew = ApplyCommandLineArgs(tcConfigB, sourceFiles, argv)
646648
FSharpParsingOptions.FromTcConfigBuilder(tcConfigB, Array.ofList sourceFilesNew, isInteractive), errorScope.Diagnostics

src/Compiler/TypedTree/TcGlobals.fs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ type TcGlobals(
185185
checkNullness: bool,
186186
useReflectionFreeCodeGen: bool,
187187
// The helper to find system types amongst referenced DLLs
188-
tryFindSysTypeCcuHelper,
188+
tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option,
189189
emitDebugInfoInQuotations: bool,
190190
noDebugAttributes: bool,
191191
pathMap: PathMap,
@@ -215,11 +215,9 @@ type TcGlobals(
215215
let mk_MFCompilerServices_tcref ccu n = mkNonLocalTyconRef2 ccu CompilerServicesPath n
216216
let mk_MFControl_tcref ccu n = mkNonLocalTyconRef2 ccu ControlPathArray n
217217

218-
let tryFindSysTypeCcu path nm =
219-
tryFindSysTypeCcuHelper path nm false
218+
let tryFindSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm false
220219

221-
let tryFindPublicSysTypeCcu path nm =
222-
tryFindSysTypeCcuHelper path nm true
220+
let tryFindPublicSysTypeCcu path nm = tryFindSysTypeCcuHelper path nm true
223221

224222
let vara = Construct.NewRigidTypar "a" envRange
225223
let varb = Construct.NewRigidTypar "b" envRange
@@ -1089,11 +1087,17 @@ type TcGlobals(
10891087
tryFindSysAttrib "System.Runtime.CompilerServices.RequiredMemberAttribute"
10901088
] |> List.choose (Option.map (fun x -> x.TyconRef))
10911089

1090+
static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name
1091+
10921092
override _.ToString() = "<TcGlobals>"
10931093

1094+
member _.directoryToResolveRelativePaths = directoryToResolveRelativePaths
1095+
10941096
member _.ilg = ilg
10951097

1096-
static member IsInEmbeddableKnownSet name = isInEmbeddableKnownSet name
1098+
member _.noDebugAttributes = noDebugAttributes
1099+
1100+
member _.tryFindSysTypeCcuHelper: string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option = tryFindSysTypeCcuHelper
10971101

10981102
member _.tryRemoveEmbeddedILTypeDefs () = [
10991103
for key in embeddedILTypeDefs.Keys.OrderBy id do

src/Compiler/TypedTree/TcGlobals.fsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ type internal TcGlobals =
152152

153153
static member IsInEmbeddableKnownSet: name: string -> bool
154154

155+
member directoryToResolveRelativePaths: string
156+
157+
member noDebugAttributes: bool
158+
159+
member tryFindSysTypeCcuHelper: (string list -> string -> bool -> FSharp.Compiler.TypedTree.CcuThunk option) with get
160+
155161
member AddFieldGeneratedAttributes:
156162
mdef: FSharp.Compiler.AbstractIL.IL.ILFieldDef -> FSharp.Compiler.AbstractIL.IL.ILFieldDef
157163

vsintegration/tests/FSharp.Editor.Tests/HelpContextServiceTests.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ type HelpContextServiceTests() =
9898
TestF1Keywords(keywords, file)
9999

100100
[<Fact>]
101-
member _.``F1 help keyword Regression.DotNetMethod.854364``() =
101+
member _.``F1 help keyword Regression.DotNetMethod-854364``() =
102102
let file = [ "let i : int = 42"; "i.ToStri$ng()"; "i.ToStri$ng(\"format\")" ]
103103
let keywords = [ Some "System.Int32.ToString"; Some "System.Int32.ToString" ]
104104
TestF1Keywords(keywords, file)
@@ -335,13 +335,13 @@ type HelpContextServiceTests() =
335335
TestF1Keywords(keywords, file)
336336

337337
[<Fact>]
338-
member _.``F1 help keyword Regression.NewInstance.854367``() =
338+
member _.``F1 help keyword Regression.NewInstance-854367``() =
339339
let file = [ "let q : System.Runtime.Remoting.TypeE$ntry = null" ]
340340
let keywords = [ Some "System.Runtime.Remoting.TypeEntry" ]
341341
TestF1Keywords(keywords, file)
342342

343343
[<Fact>]
344-
member _.``F1 help keyword Regression.NewInstance.854367.2``() =
344+
member _.``F1 help keyword Regression.NewInstance-854367-2``() =
345345
let file =
346346
[
347347
"let q1 = new System.Runtime.Remoting.Type$Entry()" // this constructor exists but is not accessible (it is protected), but the help entry still goes to the type

vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ module Test =
508508
()
509509

510510
[<Fact>]
511-
let ``Automation.LetBindings.InsideType.Instance`` () =
511+
let ``Automation.LetBindings.Instance`` () =
512512
let code =
513513
"""
514514
namespace FsTest
@@ -525,7 +525,7 @@ module Test =
525525
Assert.StartsWith(expectedSignature, tooltip)
526526

527527
[<Fact>]
528-
let ``Automation.LetBindings.InsideType.Static`` () =
528+
let ``Automation.LetBindings.Static`` () =
529529
let code =
530530
"""
531531
namespace FsTest
@@ -535,15 +535,15 @@ module Test =
535535
static let fu$$nc x = ()
536536
"""
537537

538-
let expectedSignature = "val func: x: 'a -> unit"
538+
let expectedSignature = "val private func: x: 'a -> unit"
539539

540540
let tooltip = GetQuickInfoTextFromCode code
541541

542542
Assert.StartsWith(expectedSignature, tooltip)
543543
()
544544

545545
[<Fact>]
546-
let ``Automation.LetBindings`` () =
546+
let ``Automation.LetBindings.Do`` () =
547547
let code =
548548
"""
549549
namespace FsTest

0 commit comments

Comments
 (0)