From 3856dad12002a1b1e576d8adc19af71de9e7970d Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 2 Nov 2022 12:22:07 -0700 Subject: [PATCH 1/6] Initial --- .gitignore | 1 - FSharp.sln | 20 +------ VisualFSharp.sln | 17 +----- .../Microsoft.FSharp.Compiler.MSBuild.csproj | 2 - .../Microsoft.FSharp.IDE.csproj | 1 - src/Compiler/FSharp.Compiler.Service.fsproj | 3 +- .../Interactive/FSharpInteractiveServer.fs | 58 +++++++++++++++++++ .../Interactive/FSharpInteractiveServer.fsi | 20 +++++++ .../AssemblyInfo.fs | 9 --- .../Directory.Build.props | 9 --- .../FSharp.Compiler.Server.Shared.fsproj | 36 ------------ .../FSharpInteractiveServer.fs | 47 --------------- src/fsi/fsi.targets | 3 - src/fsi/fsimain.fs | 12 ++-- .../Source.extension.vsixmanifest | 2 - .../VisualFSharp.Core.targets | 12 ---- .../FSharp.LanguageService.fsproj | 1 - .../FSharp.ProjectSystem.FSharp.fsproj | 5 -- .../src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj | 3 +- vsintegration/src/FSharp.VS.FSI/sessions.fs | 43 +++++++------- vsintegration/update-vsintegration.cmd | 4 -- 21 files changed, 114 insertions(+), 194 deletions(-) create mode 100644 src/Compiler/Interactive/FSharpInteractiveServer.fs create mode 100644 src/Compiler/Interactive/FSharpInteractiveServer.fsi delete mode 100644 src/FSharp.Compiler.Server.Shared/AssemblyInfo.fs delete mode 100644 src/FSharp.Compiler.Server.Shared/Directory.Build.props delete mode 100644 src/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj delete mode 100644 src/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs diff --git a/.gitignore b/.gitignore index 3cfeb6c1cb3..78418b2b36b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ scripts/*.patch /src/FSharp.Build/*.resx /src/fsi/*.resx /src/FSharp.Compiler.Interactive.Settings/*.resx -/src/FSharp.Compiler.Server.Shared/*.resx /src/fsi/Fsi.sln /src/FSharp.Build/*.resources /src/Compiler/*.resx diff --git a/FSharp.sln b/FSharp.sln index 9744d3283ef..364764378bb 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32113.165 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}" -EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}" @@ -98,9 +96,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsi\fsiAny EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiArm64", "src\fsi\fsiArm64Project\fsiArm64.fsproj", "{209C7D37-8C01-413C-8698-EC25F4C86976}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}" ProjectSection(SolutionItems) = preProject src\Compiler\FSComp.txt = src\Compiler\FSComp.txt @@ -116,18 +115,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -433,7 +420,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142} {DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6} {702A7979-BCF9-4C41-853E-3ADFC9897890} = {B8DDA694-7939-42E3-95E5-265C2217C142} {649FA588-F02E-457C-9FCF-87E46407481E} = {B8DDA694-7939-42E3-95E5-265C2217C142} diff --git a/VisualFSharp.sln b/VisualFSharp.sln index 343c976316e..60b7ece4d7f 100644 --- a/VisualFSharp.sln +++ b/VisualFSharp.sln @@ -33,8 +33,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.VS.FSI", "vsintegrat EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualFSharpFull", "vsintegration\Vsix\VisualFSharpFull\VisualFSharpFull.csproj", "{59ADCE46-9740-4079-834D-9A03A3494EBC}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}" -EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.LanguageService", "vsintegration\src\FSharp.LanguageService\FSharp.LanguageService.fsproj", "{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F}" @@ -193,7 +191,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FCSBenchmarks", "FCSBenchma tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1 = tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1 EndProjectSection EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -229,18 +227,6 @@ Global {59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.Build.0 = Release|Any CPU {59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.ActiveCfg = Release|Any CPU {59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -1045,7 +1031,6 @@ Global {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D} {991DCF75-C2EB-42B6-9A0D-AA1D2409D519} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D} {59ADCE46-9740-4079-834D-9A03A3494EBC} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D} - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142} {DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6} {EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B} {1C5C163C-37EA-4A3C-8CCC-0D34B74BF8EF} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B} diff --git a/setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj b/setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj index d96bbf1e59d..eb3190a7418 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj +++ b/setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj @@ -13,7 +13,6 @@ - @@ -108,7 +107,6 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools" file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll" file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll" file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll" - file source="$(BinariesFolder)FSharp.Compiler.Server.Shared\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.xml" file source="$(BinariesFolder)FSharp.Build\$(Configuration)\netstandard2.0\FSharp.Build.dll" vs.file.ngen=no vs.file.ngenArchitecture=All vs.file.ngenPriority=2 diff --git a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.csproj b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.csproj index 834d95d3bf1..d78d0b6d1e9 100644 --- a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.csproj +++ b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.csproj @@ -18,7 +18,6 @@ <_Dependency Include="FSharp.Compiler.Interactive.Settings" Version="$(FSProductVersion)" /> <_Dependency Include="FSharp.Compiler.Service" Version="$(FSharpCompilerServiceVersion)" /> <_Dependency Include="FSharp.DependencyManager.Nuget" Version="$(FSProductVersion)" /> - <_Dependency Include="FSharp.Compiler.Server.Shared" Version="$(FSProductVersion)" /> <_Dependency Include="FSharp.Core" Version="$(FSCoreVersion)" /> <_Dependency Include="FSharp.Editor" Version="$(VSAssemblyVersion)" /> <_Dependency Include="FSharp.LanguageService.Base" Version="$(VSAssemblyVersion)" /> diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index 98a87e8d736..e7468b34086 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -69,7 +69,6 @@ - @@ -456,6 +455,8 @@ + + diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fs b/src/Compiler/Interactive/FSharpInteractiveServer.fs new file mode 100644 index 00000000000..d39d5e43b5b --- /dev/null +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.Interactive + +open System +open System.Text +open System.Diagnostics +open System.IO +open System.IO.Pipes +open System.Threading + +module CtrlBreakHandlers = + + let interuptCommand = "Interactive-CtrlCNotificationCommand-Interupt" + let lineInteruptCommand = Encoding.UTF8.GetBytes(interuptCommand + Environment.NewLine) + let connectionTimeout = 1000 + + [] + type public CtrlBreakService(channelName: string) = + + abstract Interrupt: unit -> unit + + // Exceptions percolate to callsite, IO exceptions must be handled by caller + // Should be run on a new thread + member this.Run(): unit = + let service = Some (new NamedPipeServerStream(channelName, PipeDirection.In)) + + match service with + | Some service -> + // Wait for a client to connect + service.WaitForConnection() + use stream = new StreamReader(service) + try + while not (stream.EndOfStream) do + let line = stream.ReadLine() + if line = interuptCommand then this.Interrupt() + finally + stream.Close() + service.Close() + | None -> () + + type public CtrlBreakClient(channelName: string) = + + let mutable service: NamedPipeClientStream option = None + + member this.Interrupt() = + match service with + | None -> () + | Some service -> + try + if not (service.IsConnected) then + service.Connect(connectionTimeout) + with _ -> () + + service.Write(lineInteruptCommand, 0, lineInteruptCommand.Length) + service.Flush() + + member _.Start() = + service <- Some (new NamedPipeClientStream(".", channelName, PipeDirection.Out)) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fsi b/src/Compiler/Interactive/FSharpInteractiveServer.fsi new file mode 100644 index 00000000000..0ee42ecfebf --- /dev/null +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fsi @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.Interactive + +module CtrlBreakHandlers = + + [] + type public CtrlBreakService = + new: channelName:string -> CtrlBreakService + + abstract Interrupt: unit -> unit + + member Run: unit -> unit + + + type public CtrlBreakClient = + new: channelName:string -> CtrlBreakClient + + member Interrupt: unit -> unit + + member Start: unit -> unit diff --git a/src/FSharp.Compiler.Server.Shared/AssemblyInfo.fs b/src/FSharp.Compiler.Server.Shared/AssemblyInfo.fs deleted file mode 100644 index d2321169772..00000000000 --- a/src/FSharp.Compiler.Server.Shared/AssemblyInfo.fs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp - -open System.Reflection -open System.Runtime.InteropServices - -[] -do () diff --git a/src/FSharp.Compiler.Server.Shared/Directory.Build.props b/src/FSharp.Compiler.Server.Shared/Directory.Build.props deleted file mode 100644 index 7cd41381b5d..00000000000 --- a/src/FSharp.Compiler.Server.Shared/Directory.Build.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - true - - - - - diff --git a/src/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj b/src/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj deleted file mode 100644 index 2b6e504664f..00000000000 --- a/src/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - net472 - FSharp.Compiler.Server.Shared - true - - - - - false - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs b/src/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs deleted file mode 100644 index 72a58118625..00000000000 --- a/src/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -//[] // avoid calling the type "Shared" which is keyword in some languages -namespace FSharp.Compiler.Server.Shared - -// For FSI VS plugin, require FSI to provide services: -// e.g. -// - interrupt -// - intellisense completion -// -// This is done via remoting. -// Here we define the service class. -// This dll is required for both client (fsi-vs plugin) and server (spawned fsi). - -//[] -[] -[] -do () - -open System -open System.Diagnostics -open System.Runtime.Remoting.Channels -open System.Runtime.Remoting -open System.Runtime.Remoting.Lifetime - -[] -type internal FSharpInteractiveServer() = - inherit System.MarshalByRefObject() - abstract Interrupt: unit -> unit - default x.Interrupt() = () - - static member StartServer(channelName: string, server: FSharpInteractiveServer) = - let chan = new Ipc.IpcChannel(channelName) - LifetimeServices.LeaseTime <- TimeSpan(7, 0, 0, 0) // days,hours,mins,secs - LifetimeServices.LeaseManagerPollTime <- TimeSpan(7, 0, 0, 0) - LifetimeServices.RenewOnCallTime <- TimeSpan(7, 0, 0, 0) - LifetimeServices.SponsorshipTimeout <- TimeSpan(7, 0, 0, 0) - ChannelServices.RegisterChannel(chan, false) - let objRef = RemotingServices.Marshal(server, "FSIServer") - () - - static member StartClient(channelName) = - let T = - Activator.GetObject(typeof, "ipc://" + channelName + "/FSIServer") - - let x = T :?> FSharpInteractiveServer - x diff --git a/src/fsi/fsi.targets b/src/fsi/fsi.targets index dcd34a0ee86..23ee6e76bfc 100644 --- a/src/fsi/fsi.targets +++ b/src/fsi/fsi.targets @@ -44,9 +44,6 @@ - - - diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index d4394269ff4..a20cbfd6577 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -11,6 +11,7 @@ module internal Sample.FSharp.Compiler.Interactive.Main open System +open System.Diagnostics open System.Globalization open System.IO open System.Reflection @@ -22,6 +23,8 @@ open System.Windows.Forms open FSharp.Compiler open FSharp.Compiler.AbstractIL +open FSharp.Compiler.Interactive +open FSharp.Compiler.Interactive.CtrlBreakHandlers open FSharp.Compiler.Interactive.Shell open FSharp.Compiler.Interactive.Shell.Settings open FSharp.Compiler.CodeAnalysis @@ -147,9 +150,9 @@ let internal TrySetUnhandledExceptionMode () = /// Starts the remoting server to handle interrupt reuests from a host tool. let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) = -#if FSI_SERVER let server = - { new Server.Shared.FSharpInteractiveServer() with + + { new CtrlBreakService (fsiServerName) with member _.Interrupt() = //printf "FSI-SERVER: received CTRL-C request...\n" try @@ -160,10 +163,7 @@ let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) = () } - Server.Shared.FSharpInteractiveServer.StartServer(fsiServerName, server) -#else - ignore (fsiSession, fsiServerName) -#endif + server.Run() //---------------------------------------------------------------------------- // GUI runCodeOnMainThread diff --git a/vsintegration/Vsix/VisualFSharpFull/Source.extension.vsixmanifest b/vsintegration/Vsix/VisualFSharpFull/Source.extension.vsixmanifest index fb2764e3d58..081cd403c50 100644 --- a/vsintegration/Vsix/VisualFSharpFull/Source.extension.vsixmanifest +++ b/vsintegration/Vsix/VisualFSharpFull/Source.extension.vsixmanifest @@ -23,7 +23,6 @@ - @@ -49,7 +48,6 @@ - diff --git a/vsintegration/Vsix/VisualFSharpFull/VisualFSharp.Core.targets b/vsintegration/Vsix/VisualFSharpFull/VisualFSharp.Core.targets index 4d86ad05cc5..f3c3ce40b79 100644 --- a/vsintegration/Vsix/VisualFSharpFull/VisualFSharp.Core.targets +++ b/vsintegration/Vsix/VisualFSharpFull/VisualFSharp.Core.targets @@ -48,18 +48,6 @@ TargetFramework=netstandard2.0 - - {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} - FSharp.Compiler.Server.Shared - BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b - DebugSymbolsProjectOutputGroup%3b - true - All - 2 - True - TargetFramework=$(DependencyTargetFramework) - - {A59DB8AE-8044-41A5-848A-800A7FF31C93} FSharp.Compiler.Service diff --git a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj index d247d927341..9c82f79ec9e 100644 --- a/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj +++ b/vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj @@ -18,7 +18,6 @@ - diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/FSharp.ProjectSystem.FSharp.fsproj b/vsintegration/src/FSharp.ProjectSystem.FSharp/FSharp.ProjectSystem.FSharp.fsproj index aab721f9de1..b472ed00da0 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/FSharp.ProjectSystem.FSharp.fsproj +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/FSharp.ProjectSystem.FSharp.fsproj @@ -71,11 +71,6 @@ $(FSharpCompilerServiceVersion) $PackageFolder$\FSharp.Compiler.Service.dll - - FSharp.Compiler.Server.Shared - $(FSProductVersion) - $PackageFolder$\FSharp.Compiler.Server.Shared.dll - FSharp.UIResources $(VSAssemblyVersion) diff --git a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj index b7819fb3611..a4fba0a23d8 100644 --- a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj +++ b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj @@ -43,8 +43,7 @@ - - + diff --git a/vsintegration/src/FSharp.VS.FSI/sessions.fs b/vsintegration/src/FSharp.VS.FSI/sessions.fs index fbd1b43c363..fd508932975 100644 --- a/vsintegration/src/FSharp.VS.FSI/sessions.fs +++ b/vsintegration/src/FSharp.VS.FSI/sessions.fs @@ -15,6 +15,9 @@ open System.Threading let mutable timeoutAppShowMessageOnTimeOut = true open Microsoft.FSharp.Control +open FSharp.Compiler.Interactive +open FSharp.Compiler.Interactive.CtrlBreakHandlers + // Wrapper around ManualResetEvent which will ignore Sets on disposed object type internal EventWrapper() = let waitHandle = new ManualResetEvent(false) @@ -129,7 +132,7 @@ let catchAll trigger x = try trigger x with err -> System.Windows.Forms.MessageBox.Show(err.ToString()) |> ignore -let determineFsiPath () = +let determineFsiPath () = if SessionsProperties.fsiUseNetCore then let pf = Environment.GetEnvironmentVariable("ProgramW6432") let pf = if String.IsNullOrEmpty(pf) then Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) else pf @@ -137,7 +140,7 @@ let determineFsiPath () = let arg = "fsi" if not (File.Exists exe) then raise (SessionError (VFSIstrings.SR.couldNotFindFsiExe exe)) - exe, arg, false, false + exe, arg, false else let fsiExeName () = if SessionsProperties.useAnyCpuVersion then @@ -152,9 +155,9 @@ let determineFsiPath () = let thisAssemblyDirectory = typeof.Assembly.Location |> Path.GetDirectoryName Path.Combine(thisAssemblyDirectory,fsiExeName() ) - // This path is relative to the location of "FSharp.Compiler.Interactive.Settings.dll" + // This path is relative to the location of "FSharp.Compiler.Service.dll" let determineFsiRelativePath2 () = - let thisAssembly : System.Reflection.Assembly = typeof.Assembly + let thisAssembly : System.Reflection.Assembly = typeof.Assembly let thisAssemblyDirectory = thisAssembly.Location |> Path.GetDirectoryName // Use the quick-development path if available Path.Combine(thisAssemblyDirectory, "Tools", fsiExeName() ) @@ -175,7 +178,7 @@ let determineFsiPath () = // Otherwise give up raise (SessionError (VFSIstrings.SR.couldNotFindFsiExe fsiRegistryPath)) - fsiExe, "", true, true + fsiExe, "", true let readOutputAsync (reader: StreamReader) trigger = let buffer = StringBuilder(1024) @@ -234,7 +237,7 @@ let readOutputAsync (reader: StreamReader) trigger = let fsiStartInfo channelName sourceFile = let procInfo = new ProcessStartInfo() - let fsiPath, fsiFirstArgs, fsiSupportsServer, fsiSupportsShadowcopy = determineFsiPath () + let fsiPath, fsiFirstArgs, fsiSupportsShadowcopy = determineFsiPath () procInfo.FileName <- fsiPath @@ -278,7 +281,7 @@ let fsiStartInfo channelName sourceFile = if Directory.Exists(initialPath) then procInfo.WorkingDirectory <- initialPath - procInfo, fsiSupportsServer + procInfo let nonNull = function null -> false | (s:string) -> true @@ -286,13 +289,13 @@ let nonNull = function null -> false | (s:string) -> true /// Represents an active F# Interactive process to which Visual Studio is connected via stdin/stdout/stderr and a remoting channel type FsiSession(sourceFile: string) = let randomSalt = System.Random() - let channelName = - let pid = System.Diagnostics.Process.GetCurrentProcess().Id - let tick = System.Environment.TickCount + let channelName = + let pid = Process.GetCurrentProcess().Id + let tick = Environment.TickCount let salt = randomSalt.Next() sprintf "FSIChannel_%d_%d_%d" pid tick salt - let procInfo, fsiSupportsServer = fsiStartInfo channelName sourceFile + let procInfo = fsiStartInfo channelName sourceFile let usingNetCore = SessionsProperties.fsiUseNetCore @@ -349,15 +352,15 @@ type FsiSession(sourceFile: string) = do cmdProcess.EnableRaisingEvents <- true - let clientConnection = - if fsiSupportsServer then - try Some (FSharp.Compiler.Server.Shared.FSharpInteractiveServer.StartClient(channelName)) - with e -> raise (SessionError (VFSIstrings.SR.exceptionRaisedWhenCreatingRemotingClient(e.ToString()))) - else - None + let clientConnection = + try + let server = CtrlBreakClient(channelName) + server.Start() + Some server + with e -> raise (SessionError (VFSIstrings.SR.exceptionRaisedWhenCreatingRemotingClient(e.ToString()))) - /// interrupt timeout in miliseconds - let interruptTimeoutMS = 1000 + /// interrupt timeout in miliseconds + let interruptTimeoutMS = 1000 // Create session object member _.Interrupt() = @@ -378,7 +381,7 @@ type FsiSession(sourceFile: string) = member _.Alive = not cmdProcess.HasExited - member _.SupportsInterrupt = not cmdProcess.HasExited && clientConnection.IsSome // clientConnection not on .NET Core + member _.SupportsInterrupt = not cmdProcess.HasExited && clientConnection.IsSome member _.ProcessID = // When using .NET Core, allow up to 2 seconds to allow detection of process ID diff --git a/vsintegration/update-vsintegration.cmd b/vsintegration/update-vsintegration.cmd index 3a7da14f77d..740e098aa65 100644 --- a/vsintegration/update-vsintegration.cmd +++ b/vsintegration/update-vsintegration.cmd @@ -274,7 +274,6 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" ( !SN32! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL !SN32! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL - !SN32! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL !SN32! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL !SN32! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL !SN32! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL @@ -293,7 +292,6 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" ( !SN64! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL !SN64! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL - !SN64! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL !SN64! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL !SN64! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL !SN64! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL @@ -346,7 +344,6 @@ if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" ( !SN32! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL !SN32! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL - !SN32! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL !SN32! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL !SN32! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL !SN32! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL @@ -365,7 +362,6 @@ if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" ( !SN64! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL !SN64! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL - !SN64! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL !SN64! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL !SN64! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL !SN64! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL From 8774640156c6de31ec54fee3d3f4d5ff70989d88 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 2 Nov 2022 12:50:36 -0700 Subject: [PATCH 2/6] test --- ...harp.CompilerService.SurfaceArea.netstandard.expected | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 1ece3f1a780..d92a97c8623 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -4151,6 +4151,15 @@ FSharp.Compiler.IO.StreamExtensions: System.String[] Stream.ReadAllLines(System. FSharp.Compiler.IO.StreamExtensions: Void Stream.WriteAllLines(System.IO.Stream, System.Collections.Generic.IEnumerable`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Text.Encoding]) FSharp.Compiler.IO.StreamExtensions: Void Stream.WriteAllText(System.IO.Stream, System.String) FSharp.Compiler.IO.StreamExtensions: Void Stream.Write[a](System.IO.Stream, a) +FSharp.Compiler.Interactive.CtrlBreakHandlers +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void .ctor(System.String) +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void Interrupt() +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void Start() +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void .ctor(System.String) +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Interrupt() +FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Run() +FSharp.Compiler.Interactive.CtrlBreakHandlers: FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient +FSharp.Compiler.Interactive.CtrlBreakHandlers: FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService FSharp.Compiler.Interactive.Shell FSharp.Compiler.Interactive.Shell+CompilerInputStream: Boolean CanRead FSharp.Compiler.Interactive.Shell+CompilerInputStream: Boolean CanSeek From 5420f41361b39d785b0e4c6b8b97c80470ab6d2f Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 2 Nov 2022 13:26:32 -0700 Subject: [PATCH 3/6] fantomas --- .../Interactive/FSharpInteractiveServer.fs | 21 ++++++++++++------- .../Interactive/FSharpInteractiveServer.fsi | 5 ++--- src/fsi/fsimain.fs | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fs b/src/Compiler/Interactive/FSharpInteractiveServer.fs index d39d5e43b5b..a440175622f 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fs +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fs @@ -11,7 +11,10 @@ open System.Threading module CtrlBreakHandlers = let interuptCommand = "Interactive-CtrlCNotificationCommand-Interupt" - let lineInteruptCommand = Encoding.UTF8.GetBytes(interuptCommand + Environment.NewLine) + + let lineInteruptCommand = + Encoding.UTF8.GetBytes(interuptCommand + Environment.NewLine) + let connectionTimeout = 1000 [] @@ -20,19 +23,22 @@ module CtrlBreakHandlers = abstract Interrupt: unit -> unit // Exceptions percolate to callsite, IO exceptions must be handled by caller - // Should be run on a new thread - member this.Run(): unit = - let service = Some (new NamedPipeServerStream(channelName, PipeDirection.In)) + // Should be run on a new thread + member this.Run() : unit = + let service = Some(new NamedPipeServerStream(channelName, PipeDirection.In)) match service with | Some service -> // Wait for a client to connect service.WaitForConnection() use stream = new StreamReader(service) + try while not (stream.EndOfStream) do let line = stream.ReadLine() - if line = interuptCommand then this.Interrupt() + + if line = interuptCommand then + this.Interrupt() finally stream.Close() service.Close() @@ -49,10 +55,11 @@ module CtrlBreakHandlers = try if not (service.IsConnected) then service.Connect(connectionTimeout) - with _ -> () + with _ -> + () service.Write(lineInteruptCommand, 0, lineInteruptCommand.Length) service.Flush() member _.Start() = - service <- Some (new NamedPipeClientStream(".", channelName, PipeDirection.Out)) + service <- Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out)) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fsi b/src/Compiler/Interactive/FSharpInteractiveServer.fsi index 0ee42ecfebf..85b4e7bacd4 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fsi +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fsi @@ -5,15 +5,14 @@ module CtrlBreakHandlers = [] type public CtrlBreakService = - new: channelName:string -> CtrlBreakService + new: channelName: string -> CtrlBreakService abstract Interrupt: unit -> unit member Run: unit -> unit - type public CtrlBreakClient = - new: channelName:string -> CtrlBreakClient + new: channelName: string -> CtrlBreakClient member Interrupt: unit -> unit diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index a20cbfd6577..c51df65f381 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -152,7 +152,7 @@ let internal TrySetUnhandledExceptionMode () = let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) = let server = - { new CtrlBreakService (fsiServerName) with + { new CtrlBreakService(fsiServerName) with member _.Interrupt() = //printf "FSI-SERVER: received CTRL-C request...\n" try From 90e98aabf0d45d38cdcb652744b2908562d907d8 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Thu, 3 Nov 2022 15:24:17 -0700 Subject: [PATCH 4/6] feedback --- .../Interactive/FSharpInteractiveServer.fs | 51 ++++++++++--------- .../Interactive/FSharpInteractiveServer.fsi | 4 +- vsintegration/src/FSharp.VS.FSI/sessions.fs | 17 +++---- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fs b/src/Compiler/Interactive/FSharpInteractiveServer.fs index a440175622f..c5ff7f1346a 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fs +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fs @@ -25,41 +25,44 @@ module CtrlBreakHandlers = // Exceptions percolate to callsite, IO exceptions must be handled by caller // Should be run on a new thread member this.Run() : unit = - let service = Some(new NamedPipeServerStream(channelName, PipeDirection.In)) + let service = new NamedPipeServerStream(channelName, PipeDirection.In) - match service with - | Some service -> - // Wait for a client to connect - service.WaitForConnection() - use stream = new StreamReader(service) + // Wait for a client to connect + service.WaitForConnection() + use stream = new StreamReader(service) - try - while not (stream.EndOfStream) do - let line = stream.ReadLine() - - if line = interuptCommand then - this.Interrupt() - finally - stream.Close() - service.Close() - | None -> () + try + while not (stream.EndOfStream) do + let line = stream.ReadLine() + + if line = interuptCommand then + this.Interrupt() + finally + stream.Close() + service.Close() type public CtrlBreakClient(channelName: string) = - let mutable service: NamedPipeClientStream option = None + let mutable service: NamedPipeClientStream option = Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out)) member this.Interrupt() = match service with | None -> () - | Some service -> + | Some client -> try - if not (service.IsConnected) then - service.Connect(connectionTimeout) + if not (client.IsConnected) then + client.Connect(connectionTimeout) with _ -> () - service.Write(lineInteruptCommand, 0, lineInteruptCommand.Length) - service.Flush() + client.Write(lineInteruptCommand, 0, lineInteruptCommand.Length) + client.Flush() + + interface IDisposable with + member _.Dispose() = + match service with + | None -> () + | Some client -> + client.Dispose() + service <- None - member _.Start() = - service <- Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out)) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fsi b/src/Compiler/Interactive/FSharpInteractiveServer.fsi index 85b4e7bacd4..2e3359dc01d 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fsi +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fsi @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace FSharp.Compiler.Interactive +open System module CtrlBreakHandlers = @@ -12,8 +13,9 @@ module CtrlBreakHandlers = member Run: unit -> unit type public CtrlBreakClient = + new: channelName: string -> CtrlBreakClient member Interrupt: unit -> unit - member Start: unit -> unit + interface IDisposable \ No newline at end of file diff --git a/vsintegration/src/FSharp.VS.FSI/sessions.fs b/vsintegration/src/FSharp.VS.FSI/sessions.fs index fd508932975..c552c0eda41 100644 --- a/vsintegration/src/FSharp.VS.FSI/sessions.fs +++ b/vsintegration/src/FSharp.VS.FSI/sessions.fs @@ -352,11 +352,9 @@ type FsiSession(sourceFile: string) = do cmdProcess.EnableRaisingEvents <- true - let clientConnection = + let client = try - let server = CtrlBreakClient(channelName) - server.Start() - Some server + new CtrlBreakClient(channelName) with e -> raise (SessionError (VFSIstrings.SR.exceptionRaisedWhenCreatingRemotingClient(e.ToString()))) /// interrupt timeout in miliseconds @@ -364,12 +362,9 @@ type FsiSession(sourceFile: string) = // Create session object member _.Interrupt() = - match clientConnection with - | None -> false - | Some client -> - match timeoutApp "VFSI interrupt" interruptTimeoutMS (fun () -> client.Interrupt()) () with - | Some () -> true - | None -> false + match timeoutApp "VFSI interrupt" interruptTimeoutMS (fun () -> client.Interrupt()) () with + | Some () -> true + | None -> false member _.SendInput (str: string) = inputQueue.Post(str) @@ -381,7 +376,7 @@ type FsiSession(sourceFile: string) = member _.Alive = not cmdProcess.HasExited - member _.SupportsInterrupt = not cmdProcess.HasExited && clientConnection.IsSome + member _.SupportsInterrupt = not cmdProcess.HasExited member _.ProcessID = // When using .NET Core, allow up to 2 seconds to allow detection of process ID From f2b84d9c50f9155eb31048a3f15293c97943065f Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Nov 2022 12:20:44 -0700 Subject: [PATCH 5/6] temp --- src/Compiler/Interactive/FSharpInteractiveServer.fs | 4 ++-- src/Compiler/Interactive/FSharpInteractiveServer.fsi | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fs b/src/Compiler/Interactive/FSharpInteractiveServer.fs index c5ff7f1346a..9c66f2df2c5 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fs +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fs @@ -43,7 +43,8 @@ module CtrlBreakHandlers = type public CtrlBreakClient(channelName: string) = - let mutable service: NamedPipeClientStream option = Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out)) + let mutable service: NamedPipeClientStream option = + Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out)) member this.Interrupt() = match service with @@ -65,4 +66,3 @@ module CtrlBreakHandlers = | Some client -> client.Dispose() service <- None - diff --git a/src/Compiler/Interactive/FSharpInteractiveServer.fsi b/src/Compiler/Interactive/FSharpInteractiveServer.fsi index 2e3359dc01d..5931fe5f12f 100644 --- a/src/Compiler/Interactive/FSharpInteractiveServer.fsi +++ b/src/Compiler/Interactive/FSharpInteractiveServer.fsi @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace FSharp.Compiler.Interactive + open System module CtrlBreakHandlers = @@ -18,4 +19,4 @@ module CtrlBreakHandlers = member Interrupt: unit -> unit - interface IDisposable \ No newline at end of file + interface IDisposable From 17417ce7bb796fd89e5df785016f451626e6b85b Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Nov 2022 13:05:57 -0700 Subject: [PATCH 6/6] surface area test --- .../FSharp.CompilerService.SurfaceArea.netstandard.expected | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index d92a97c8623..e16c7c278a7 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -4154,7 +4154,6 @@ FSharp.Compiler.IO.StreamExtensions: Void Stream.Write[a](System.IO.Stream, a) FSharp.Compiler.Interactive.CtrlBreakHandlers FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void .ctor(System.String) FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void Interrupt() -FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void Start() FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void .ctor(System.String) FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Interrupt() FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Run()