Skip to content

Commit

Permalink
Merge branch 'eld' of https://github.com/dsyme/visualfsharp into eld
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme committed May 19, 2017
2 parents 20ec3f0 + bb879e0 commit 344b205
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.


let private x : int = failwith ""

let inline f () = x

let f1 argv =
let x = 1 + 1.0
let y = argx // this gives
//let x = 1 + 1.0
let y = argx // this gives a multi-line error message
printfn "%A" argv
0 // return an integer exit code

[<EntryPoint>]
let main argv =
//let x = 1 + 1.0
let y = argx // this gives
//let y = argx // this gives
printfn "%A" argv
0 // return an integer exit code

9 changes: 6 additions & 3 deletions vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ module internal RoslynHelpers =
let StartAsyncUnitAsTask cancellationToken (computation:Async<unit>) =
StartAsyncAsTask cancellationToken computation :> Task

let SupportedDiagnostics() =
let private TheSupportedDiagnostics =
// We are constructing our own descriptors at run-time. Compiler service is already doing error formatting and localization.
let dummyDescriptor = DiagnosticDescriptor("0", String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error, true, null, null)
ImmutableArray.Create<DiagnosticDescriptor>(dummyDescriptor)
let dummyDescriptors =
[| for i in 0 .. 10000 -> DiagnosticDescriptor(sprintf "FS%04d" i, String.Empty, String.Empty, String.Empty, DiagnosticSeverity.Error, true, null, null) |]
ImmutableArray.Create<DiagnosticDescriptor>(dummyDescriptors)

let SupportedDiagnostics() = TheSupportedDiagnostics

let ConvertError(error: FSharpErrorInfo, location: Location) =
// Normalize the error message into the same format that we will receive it from the compiler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ type FSharpChecker with
if func.IsProperty then
let fullNames =
[| if func.HasGetterMethod then
yield func.GetterMethod.EnclosingEntity.Value.TryGetFullName()
match func.GetterMethod.EnclosingEntity with
| Some e -> yield e.TryGetFullName()
| None -> ()
if func.HasSetterMethod then
yield func.SetterMethod.EnclosingEntity.Value.TryGetFullName()
match func.SetterMethod.EnclosingEntity with
| Some e -> yield e.TryGetFullName()
| None -> ()
|]
|> Array.choose id
match fullNames with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,7 @@ private void BuildStartedHandler(object sender, BuildStartedEventArgs buildEvent
finally
{
if (errorReporter != null) {
//UIThread.Run(delegate ()
// {
errorReporter.ClearErrors();
// });
errorReporter.ClearErrors();
}
}
}
Expand Down
68 changes: 1 addition & 67 deletions vsintegration/src/FSharp.ProjectSystem.FSharp/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -209,31 +209,6 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
// FSI-LINKAGE-POINT: unsited init
do Microsoft.VisualStudio.FSharp.Interactive.Hooks.fsiConsoleWindowPackageCtorUnsited (this :> Package)

let mutable componentID = 0u

let thisLock = obj()

// Get the ComponentManager lazily, as the service may not yet have been created at package instantiation
member internal this.ComponentManager with get () = this.GetService(typeof<SOleComponentManager>) :?> IOleComponentManager

member this.RegisterForIdleTime() =

Debug.Assert(not (isNull this.ComponentManager), "No IOleComponentManager service. Idle operations (such as flushing the 'Error List' queue) will not be performed.")

if not (isNull this.ComponentManager) && componentID = 0u then
lock (thisLock) (fun _ ->
if componentID = 0u then
let crinfo = Array.zeroCreate<OLECRINFO>(1)
let mutable crinfo0 = crinfo.[0]
crinfo0.cbSize <- Marshal.SizeOf(typeof<OLECRINFO>) |> uint32
crinfo0.grfcrf <- uint32 (_OLECRF.olecrfNeedIdleTime ||| _OLECRF.olecrfNeedPeriodicIdleTime)
crinfo0.grfcadvf <- uint32 (_OLECADVF.olecadvfModal ||| _OLECADVF.olecadvfRedrawOff ||| _OLECADVF.olecadvfWarningsOff)
crinfo0.uIdleTimeInterval <- 1000u
crinfo.[0] <- crinfo0

this.ComponentManager.FRegisterComponent(this, crinfo, &componentID) |> ignore
)

/// This method loads a localized string based on the specified resource.
/// <param name="resourceName">Resource to load</param>
Expand Down Expand Up @@ -336,15 +311,14 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
Microsoft.VisualStudio.FSharp.Interactive.Hooks.fsiConsoleWindowPackageInitalizeSited (this :> Package) commandService
// FSI-LINKAGE-POINT: private method GetDialogPage forces fsi options to be loaded
let _fsiPropertyPage = this.GetDialogPage(typeof<Microsoft.VisualStudio.FSharp.Interactive.FsiPropertyPage>)
this.RegisterForIdleTime()
()

/// This method is called during Devenv /Setup to get the bitmap to
/// display on the splash screen for this package.
/// This method may be deprecated - IdIcoLogoForAboutbox should now be called instead
// REVIEW: If this turns out to be true, remove the IdBmpSplash resource
member this.getIdBmpSplash(pIdBmp:byref<uint32>) =
pIdBmp <- 0u ;
pIdBmp <- 0u
VSConstants.S_OK

/// This method is called to get the icon that will be displayed in the
Expand Down Expand Up @@ -383,52 +357,12 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
pIdIco <- 400u
VSConstants.S_OK

override this.Dispose(disposing) =
try
if not (isNull this.ComponentManager) && componentID <> 0u then
lock (thisLock) (fun _ ->
if componentID <> 0u then
this.ComponentManager.FRevokeComponent(componentID) |> ignore
componentID <- 0u)
finally
base.Dispose(disposing)

interface Microsoft.VisualStudio.FSharp.Interactive.ITestVFSI with
member this.SendTextInteraction(s:string) =
GetToolWindowAsITestVFSI().SendTextInteraction(s)
member this.GetMostRecentLines(n:int) : string[] =
GetToolWindowAsITestVFSI().GetMostRecentLines(n)

// Can we get rid of this now?
interface IOleComponent with
override this.FContinueMessageLoop(_uReason:uint32, _pvLoopData:IntPtr, _pMsgPeeked:MSG[]) = 1

override this.FDoIdle(grfidlef:uint32) =
// see e.g "C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\IDL\olecm.idl" for details
//Trace.Print("CurrentDirectoryDebug", (fun () -> sprintf "curdir='%s'\n" (System.IO.Directory.GetCurrentDirectory()))) // can be useful for watching how GetCurrentDirectory changes
let periodic = (grfidlef &&& (uint32 _OLEIDLEF.oleidlefPeriodic)) <> 0u
if periodic && not (isNull this.ComponentManager) && this.ComponentManager.FContinueIdle() <> 0 then
0 //TaskReporterIdleRegistration.DoIdle(this.ComponentManager)
else
0

override this.FPreTranslateMessage(_pMsg) = 0

override this.FQueryTerminate(_fPromptUser) = 1

override this.FReserved1(_dwReserved, _message, _wParam, _lParam) = 1

override this.HwndGetWindow(_dwWhich, _dwReserved) = 0n

override this.OnActivationChange(_pic, _fSameComponent, _pcrinfo, _fHostIsActivating, _pchostinfo, _dwReserved) = ()

override this.OnAppActivate(_fActive, _dwOtherThreadID) = ()

override this.OnEnterState(_uStateID, _fEnter) = ()

override this.OnLoseActivation() = ()

override this.Terminate() = ()

/// Factory for creating our editor, creates FSharp Projects
[<Guid(GuidList.guidFSharpProjectFactoryString)>]
Expand Down
4 changes: 3 additions & 1 deletion vsintegration/tests/unittests/Tests.ProjectSystem.Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,8 @@ type Project() =
if File.Exists(absFilePath) then File.Delete(absFilePath)
))

(* Disabled for now - see https://github.com/Microsoft/visualfsharp/pull/3071 - this is testing old project system features
[<Test>]
member public this.``RenameFile.BuildActionIsResetBasedOnFilenameExtension``() =
let GetTextFromBuildAction (action:VSLangProj.prjBuildAction) =
Expand Down Expand Up @@ -830,7 +832,7 @@ type Project() =
VsMocks.vsUIShellShowMessageBoxResult <- None
File.Delete(currentAbsoluteFilePath)
))

*)


[<Test>]
Expand Down

0 comments on commit 344b205

Please sign in to comment.