Skip to content

Commit 8f2d612

Browse files
committed
fixes to integration
1 parent eea4958 commit 8f2d612

File tree

9 files changed

+29
-619
lines changed

9 files changed

+29
-619
lines changed

paket.dependencies

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ nuget SQLite.Net.Platform.Generic 2.4.1
99
nuget FAKE
1010
nuget FSharp.Formatting
1111
nuget SourceLink.Fake
12+
nuget fssrgen
13+
nuget FSharp.SRGen.Build.Tasks
1214

1315
github fsharp/FAKE modules/Octokit/Octokit.fsx

src/fsharp/vs/service.fsi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,13 @@ type FSharpChecker =
520520
/// <param name="options">The options for the project or script.</param>
521521
member ParseAndCheckProject : options: FSharpProjectOptions -> Async<FSharpCheckProjectResults>
522522

523+
/// <summary>
524+
/// <para>Create resources for the project and keep the project alive until the returned object is disposed.</para>
525+
/// </summary>
526+
///
527+
/// <param name="options">The options for the project or script.</param>
528+
member KeepProjectAlive : options: FSharpProjectOptions -> Async<IDisposable>
529+
523530
/// <summary>
524531
/// <para>For a given script file, get the FSharpProjectOptions implied by the #load closure.</para>
525532
/// <para>All files are read from the FileSystem API, except the file being checked.</para>

tests/service/Common.fs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
<<<<<<< HEAD
2-
module FSharp.Compiler.Service.Tests.Common
3-
4-
open System.IO
5-
open Microsoft.FSharp.Compiler
6-
open Microsoft.FSharp.Compiler.SourceCodeServices
7-
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices
8-
=======
9-
module internal FSharp.Compiler.Service.Tests.Common
1+
module FSharp.Compiler.Service.Tests.Common
102

113
open System.IO
124
open System.Collections.Generic
135
open Microsoft.FSharp.Compiler
146
open Microsoft.FSharp.Compiler.SourceCodeServices
15-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
167

178
// Create one global interactive checker instance
189
let checker = FSharpChecker.Create()
@@ -47,30 +38,17 @@ let getBackgroundCheckResultsForScriptText (input) =
4738

4839
let sysLib nm =
4940
if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows
50-
<<<<<<< HEAD
51-
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\" + nm + ".dll"
52-
=======
53-
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\" + nm + ".dll"
54-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
41+
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\" + nm + ".dll"
5542
else
5643
let sysDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
5744
let (++) a b = System.IO.Path.Combine(a,b)
5845
sysDir ++ nm + ".dll"
5946

60-
<<<<<<< HEAD
61-
let fsCore4300() =
47+
let fsCoreDefaultReference() =
6248
if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows
63-
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll"
49+
@"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll"
6450
else
6551
sysLib "FSharp.Core"
66-
=======
67-
let fsCoreDefaultReference() =
68-
UnitTests.TestLib.Utils.Helpers.PathRelativeToTestAssembly "FSharp.Core.dll"
69-
// if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows
70-
// @"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll"
71-
//else
72-
// sysLib "FSharp.Core"
73-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
7452

7553

7654
let mkProjectCommandLineArgs (dllName, fileNames) =
@@ -91,12 +69,6 @@ let mkProjectCommandLineArgs (dllName, fileNames) =
9169
[ yield sysLib "mscorlib"
9270
yield sysLib "System"
9371
yield sysLib "System.Core"
94-
<<<<<<< HEAD
95-
yield fsCore4300() ]
96-
for r in references do
97-
yield "-r:" + r |]
98-
99-
=======
10072
yield fsCoreDefaultReference() ]
10173
for r in references do
10274
yield "-r:" + r |]
@@ -196,4 +168,3 @@ let rec allSymbolsInEntities compGen (entities: IList<FSharpEntity>) =
196168
yield! allSymbolsInEntities compGen e.NestedEntities ]
197169

198170

199-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823

tests/service/EditorTests.fs

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11

22
#if INTERACTIVE
3-
<<<<<<< HEAD
43
#r "../../bin/v4.5/FSharp.Compiler.Service.dll"
54
#r "../../packages/NUnit/lib/nunit.framework.dll"
65
#load "FsUnit.fs"
76
#load "Common.fs"
87
#else
9-
module FSharp.Compiler.Service.Tests.Editor
10-
=======
11-
#r "../../Debug/net40/bin/FSharp.LanguageService.Compiler.dll"
12-
#r "../../Debug/net40/bin/nunit.framework.dll"
13-
#load "FsUnit.fs"
14-
#load "Common.fs"
15-
#else
168
module Tests.Service.Editor
17-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
189
#endif
1910

2011
open NUnit.Framework
@@ -23,10 +14,7 @@ open System
2314
open System.IO
2415
open Microsoft.FSharp.Compiler
2516
open Microsoft.FSharp.Compiler.SourceCodeServices
26-
<<<<<<< HEAD
2717
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices
28-
=======
29-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
3018
open FSharp.Compiler.Service.Tests.Common
3119

3220

@@ -61,10 +49,7 @@ let ``Intro test`` () =
6149

6250
// Get tool tip at the specified location
6351
let tip = typeCheckResults.GetToolTipTextAlternate(4, 7, inputLines.[1], ["foo"], identToken) |> Async.RunSynchronously
64-
<<<<<<< HEAD
6552
(sprintf "%A" tip).Replace("\n","") |> shouldEqual """FSharpToolTipText [Single ("val foo : unit -> unitFull name: Test.foo",None)]"""
66-
=======
67-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
6853
// Get declarations (autocomplete) for a location
6954
let decls = typeCheckResults.GetDeclarationListInfo(Some untyped, 7, 23, inputLines.[6], [], "msg", fun _ -> false)|> Async.RunSynchronously
7055
[ for item in decls.Items -> item.Name ] |> shouldEqual
@@ -400,7 +385,6 @@ let _ = List.map (sprintf @"%A
400385
let _ = (10, 12) ||> sprintf "%A
401386
%O"
402387
let _ = sprintf "\n%-8.1e+567" 1.0
403-
<<<<<<< HEAD
404388
let _ = sprintf @"%O\n%-5s" "1" "2"
405389
let _ = sprintf "%%"
406390
let _ = sprintf " %*%" 2
@@ -416,15 +400,11 @@ let _ = sprintf " %6.*%" 3
416400
let _ = printf " %a" (fun _ _ -> ()) 2
417401
let _ = printf " %*a" 3 (fun _ _ -> ()) 2
418402
"""
419-
=======
420-
let _ = sprintf @"%O\n%-5s" "1" "2" """
421-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
422403

423404
let file = "/home/user/Test.fsx"
424405
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
425406

426407
typeCheckResults.Errors |> shouldEqual [||]
427-
<<<<<<< HEAD
428408
typeCheckResults.GetFormatSpecifierLocationsAndArity()
429409
|> Array.map (fun (range,numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
430410
|> shouldEqual [|(2, 45, 2, 46, 1);
@@ -457,26 +437,6 @@ let _ = sprintf @"%O\n%-5s" "1" "2" """
457437
(32, 27, 32, 31, 1);
458438
(33, 28, 33, 29, 2);
459439
(34, 29, 34, 31, 3)|]
460-
=======
461-
typeCheckResults.GetFormatSpecifierLocations()
462-
|> Array.map (fun range -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn)
463-
|> shouldEqual [|(2, 45, 2, 46);
464-
(3, 23, 3, 24);
465-
(4, 38, 4, 39);
466-
(5, 29, 5, 30);
467-
(6, 17, 6, 19);
468-
(7, 17, 7, 21);
469-
(8, 17, 8, 22);
470-
(9, 18, 9, 21);
471-
(10, 18, 10, 20);
472-
(12, 12, 12, 14);
473-
(15, 12, 15, 14);
474-
(16, 28, 16, 29);
475-
(18, 30, 18, 31);
476-
(19, 30, 19, 31);
477-
(20, 19, 20, 24);
478-
(21, 18, 21, 19); (21, 22, 21, 25)|]
479-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
480440

481441
[<Test>]
482442
let ``Printf specifiers for triple-quote strings`` () =
@@ -494,22 +454,13 @@ let _ = List.iter(printfn \"\"\"%-A
494454
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
495455

496456
typeCheckResults.Errors |> shouldEqual [||]
497-
<<<<<<< HEAD
498457
typeCheckResults.GetFormatSpecifierLocationsAndArity()
499458
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
500459
|> shouldEqual [|(2, 19, 2, 21, 1);
501460
(4, 12, 4, 14, 1);
502461
(6, 29, 6, 31, 1);
503462
(7, 29, 7, 30, 1);
504463
(7, 33, 7, 34, 1)|]
505-
=======
506-
typeCheckResults.GetFormatSpecifierLocations()
507-
|> Array.map (fun range -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn)
508-
|> shouldEqual [|(2, 19, 2, 21);
509-
(4, 12, 4, 14);
510-
(6, 29, 6, 31);
511-
(7, 29, 7, 30); (7, 33, 7, 34)|]
512-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
513464

514465
[<Test>]
515466
let ``Printf specifiers for user-defined functions`` () =
@@ -524,7 +475,6 @@ let _ = debug "[LanguageService] Type checking fails for '%s' with content=%A an
524475
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
525476

526477
typeCheckResults.Errors |> shouldEqual [||]
527-
<<<<<<< HEAD
528478
typeCheckResults.GetFormatSpecifierLocationsAndArity()
529479
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
530480
|> shouldEqual [|(3, 24, 3, 25, 1);
@@ -533,35 +483,20 @@ let _ = debug "[LanguageService] Type checking fails for '%s' with content=%A an
533483
(4, 75, 4, 76, 1);
534484
(4, 82, 4, 83, 1);
535485
(4, 108, 4, 109, 1)|]
536-
=======
537-
typeCheckResults.GetFormatSpecifierLocations()
538-
|> Array.map (fun range -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn)
539-
|> shouldEqual [|(3, 24, 3, 25);
540-
(3, 29, 3, 30);
541-
(4, 58, 4, 59); (4, 75, 4, 76); (4, 82, 4, 83); (4, 108, 4, 109)|]
542-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
543486

544487
[<Test>]
545488
let ``should not report format specifiers for illformed format strings`` () =
546489
let input =
547490
"""
548491
let _ = sprintf "%.7f %7.1A %7.f %--8.1f"
549-
<<<<<<< HEAD
550-
=======
551492
let _ = sprintf "%%A"
552-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
553493
let _ = sprintf "ABCDE"
554494
"""
555495

556496
let file = "/home/user/Test.fsx"
557497
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
558-
<<<<<<< HEAD
559498
typeCheckResults.GetFormatSpecifierLocationsAndArity()
560499
|> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs)
561-
=======
562-
typeCheckResults.GetFormatSpecifierLocations()
563-
|> Array.map (fun range -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn)
564-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
565500
|> shouldEqual [||]
566501

567502
[<Test>]

tests/service/FSharp.Compiler.Service.Tests.fsproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@
7171
<Reference Include="FSharp.Compiler.Interactive.Settings">
7272
<HintPath>FSharp.Compiler.Interactive.Settings.dll</HintPath>
7373
</Reference>
74-
<Reference Include="FSharp.Compiler.Service">
75-
<HintPath>..\..\bin\$(TargetFrameworkVersion)\FSharp.Compiler.Service.dll</HintPath>
76-
</Reference>
7774
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
7875
<Private>False</Private>
7976
</Reference>
@@ -91,6 +88,11 @@
9188
<Project>{893c3cd9-5af8-4027-a667-21e62fc2c703}</Project>
9289
<Private>True</Private>
9390
</ProjectReference>
91+
<ProjectReference Include="..\..\src\fsharp\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj">
92+
<Name>FSharp.Compiler.Service</Name>
93+
<Project>{2e4d67b4-522d-4cf7-97e4-ba940f0b18f3}</Project>
94+
<Private>True</Private>
95+
</ProjectReference>
9496
<ProjectReference Include="data\CSharp_Analysis\CSharp_Analysis.csproj">
9597
<Name>CSharp_Analysis</Name>
9698
<Project>{887630a3-4b1d-40ea-b8b3-2d842e9c40db}</Project>

tests/service/FileSystemTests.fs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
#if INTERACTIVE
2-
<<<<<<< HEAD
32
#r "../../bin/v4.5/FSharp.Compiler.Service.dll"
43
#r "../../packages/NUnit/lib/nunit.framework.dll"
54
#load "FsUnit.fs"
65
#load "Common.fs"
76
#else
8-
module FileSystemTests
9-
=======
10-
#r "../../Debug/net40/bin/FSharp.LanguageService.Compiler.dll"
11-
#r "../../Debug/net40/bin/nunit.framework.dll"
12-
#load "FsUnit.fs"
13-
#load "Common.fs"
14-
#else
157
module Tests.Service.FileSystemTests
16-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
178
#endif
189

1910

@@ -24,24 +15,16 @@ open System.IO
2415
open System.Collections.Generic
2516
open System.Text
2617
open Microsoft.FSharp.Compiler
27-
<<<<<<< HEAD
2818
open Microsoft.FSharp.Compiler.Interactive.Shell
29-
=======
30-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
3119
open Microsoft.FSharp.Compiler.SourceCodeServices
3220
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
3321
open FSharp.Compiler.Service.Tests.Common
3422

3523
let fileName1 = @"c:\mycode\test1.fs" // note, the path doesn' exist
3624
let fileName2 = @"c:\mycode\test2.fs" // note, the path doesn' exist
3725

38-
<<<<<<< HEAD
3926
type MyFileSystem(defaultFileSystem:IFileSystem) =
40-
=======
41-
type internal MyFileSystem(defaultFileSystem:IFileSystem) =
42-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
4327
let file1 = """
44-
module File1
4528
4629
let A = 1"""
4730
let file2 = """

tests/service/FsUnit.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ let Empty = new EmptyConstraint()
3838

3939
let EmptyString = new EmptyStringConstraint()
4040

41-
<<<<<<< HEAD
4241
let NullOrEmptyString = new NullOrEmptyStringConstraint()
43-
=======
44-
//let NullOrEmptyString = new NullOrEmptyStringConstraint()
45-
>>>>>>> 7b91c1855dc74d34e847e55b79e12ea605b3d823
4642

4743
let True = new TrueConstraint()
4844

0 commit comments

Comments
 (0)