Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
UIThread (#5128)
  • Loading branch information
KevinRansom authored Jun 7, 2018
commit 91f490660c80f5c64fe930f7425275909f4c10d3
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
using VsShell = Microsoft.VisualStudio.Shell.VsShellUtilities;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.VisualStudio.FSharp.LanguageService {
namespace Microsoft.VisualStudio.FSharp.LanguageService
{
internal static class UIThread {
static SynchronizationContext ctxt;
static bool isUnitTestingMode = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ internal BackgroundRequest_DEPRECATED CreateBackgroundRequest(FSharpSourceBase_D
// Implemented in FSharpLanguageService.fs
internal abstract BackgroundRequest_DEPRECATED CreateBackgroundRequest(int line, int col, TokenInfo info, string sourceText, ITextSnapshot snapshot, MethodTipMiscellany_DEPRECATED methodTipMiscellany, string fname, BackgroundRequestReason reason, IVsTextView view,AuthoringSink sink, ISource source, int timestamp, bool synchronous);

// Implemented in FSharpLanguageService.fs
internal abstract void OnParseFileOrCheckFileComplete(BackgroundRequest_DEPRECATED req);
// Implemented in FSharpLanguageService.fs
internal abstract void OnParseFileOrCheckFileComplete(BackgroundRequest_DEPRECATED req);

internal void EnsureBackgroundThreadStarted()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using EnvDTE;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Microsoft.VisualStudio.OLE.Interop;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using EnvDTE;
using System.Globalization;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Microsoft.VisualStudio.OLE.Interop;
using EnvDTE;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;


namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;


namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.VisualStudio.FSharp.ProjectSystem;
using VSLangProj;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using VSLangProj;
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem.Automation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3172,15 +3172,15 @@ string newTargetFrameworkMoniker

// replace existing fscore with one that has matching version with current target framework
var existingFsCore =
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.DoOnUIThread(
UIThread.DoOnUIThread(
() => references
.OfType<Automation.OAAssemblyReference>()
.FirstOrDefault(r => r.Name == fsCoreName.Name && r.PublicKeyToken == Utilities.FsCorePublicKeyToken && r.Culture == fsCoreName.CultureName)
);

if (existingFsCore != null)
{
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.DoOnUIThread(() =>
UIThread.DoOnUIThread(() =>
{
// save copyLocal value - after calling existingFsCore.Remove() becomes invalid and can raise exceptions
var copyLocal = existingFsCore.CopyLocal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.Win32;
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using Microsoft.VisualStudio.FSharp.LanguageService;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
Expand Down Expand Up @@ -251,22 +250,22 @@ private void AddToErrorList(
span.iEndLine = endLine < startLine ? span.iStartLine : endLine;
span.iEndIndex = (endColumn < startColumn) && (span.iStartLine == span.iEndLine) ? span.iStartIndex : endColumn;

if (OutputWindowPane != null
&& (this.Verbosity != LoggerVerbosity.Quiet || errorEvent is BuildErrorEventArgs))
{
// Format error and output it to the output window
string message = this.FormatMessage(errorEvent.Message);
if (OutputWindowPane != null
&& (this.Verbosity != LoggerVerbosity.Quiet || errorEvent is BuildErrorEventArgs))
{
// Format error and output it to the output window
string message = this.FormatMessage(errorEvent.Message);
DefaultCompilerError e = new DefaultCompilerError(file,
span.iStartLine,
span.iStartIndex,
span.iEndLine,
span.iEndIndex,
errorCode,
message);
e.IsWarning = isWarning;
message);
e.IsWarning = isWarning;

Output(GetFormattedErrorMessage(e));
}
Output(GetFormattedErrorMessage(e));
}

UIThread.Run(delegate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using IServiceProvider = System.IServiceProvider;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.FSharp.LanguageService;
using System.Runtime.Versioning;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.VisualStudio.FSharp.LanguageService;
using Microsoft.Win32;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.Build.Execution;

using Microsoft.VisualStudio.FSharp.LanguageService;
using Microsoft.VisualStudio.TextManager.Interop;

namespace Microsoft.VisualStudio.FSharp.ProjectSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void DropReferencedProjectCache()
/// </summary>
public void CleanProjectReferenceErrorState()
{
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.DoOnUIThread(() =>
UIThread.DoOnUIThread(() =>
{
if (projectRefError != null)
{
Expand All @@ -262,7 +262,7 @@ public void CleanProjectReferenceErrorState()
/// <param name="text"></param>
private void SetError(string text)
{
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.DoOnUIThread(() =>
UIThread.DoOnUIThread(() =>
{
// delete existing error if exists
CleanProjectReferenceErrorState();
Expand Down Expand Up @@ -295,7 +295,7 @@ private void SetProjectReferencesHigherVersionWarningMessage()
/// </summary>
public void RefreshProjectReferenceErrorState()
{
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.DoOnUIThread(() =>
UIThread.DoOnUIThread(() =>
{
CleanProjectReferenceErrorState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using VsShell = Microsoft.VisualStudio.Shell.VsShellUtilities;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.VisualStudio.FSharp.LanguageService
namespace Microsoft.VisualStudio.FSharp.ProjectSystem
{
internal static class UIThread
{
Expand Down
3 changes: 2 additions & 1 deletion vsintegration/src/FSharp.ProjectSystem.FSharp/Project.fs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
resourceValue

override this.Initialize() =
UIThread.CaptureSynchronizationContext()
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.CaptureSynchronizationContext()
Microsoft.VisualStudio.FSharp.ProjectSystem.UIThread.CaptureSynchronizationContext()

base.Initialize()

Expand Down
1 change: 1 addition & 0 deletions vsintegration/tests/UnitTests/TestLib.Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module Asserts =

module UIStuff =
let SetupSynchronizationContext() =
Microsoft.VisualStudio.FSharp.ProjectSystem.UIThread.InitUnitTestingMode()
Microsoft.VisualStudio.FSharp.LanguageService.UIThread.InitUnitTestingMode()

module FilesystemHelpers =
Expand Down