diff --git a/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs b/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs
index 46757d93aa5389ed34bac14f1b86f3d2accfd85b..59dea4af71f8e7c821a492cd0182e4391734a89e 100644
--- a/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs
+++ b/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs
@@ -4,7 +4,11 @@
using System.Linq;
using System.Threading;
using System.Xml.Linq;
+using Microsoft.CodeAnalysis.Editor.CSharp.ChangeSignature;
+using Microsoft.CodeAnalysis.Editor.Implementation.Interactive;
+using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature;
+using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Roslyn.Test.Utilities;
using Xunit;
@@ -257,5 +261,51 @@ void M()
}
}
}
+
+ [Fact]
+ [Trait(Traits.Feature, Traits.Features.ChangeSignature)]
+ [Trait(Traits.Feature, Traits.Features.Interactive)]
+ public void ChangeSignatureCommandDisabledInSubmission()
+ {
+ var exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsCodeFixService)));
+
+ using (var workspace = TestWorkspaceFactory.CreateWorkspace(XElement.Parse(@"
+
+
+ class C
+ {
+ void M$$(int x)
+ {
+ }
+ }
+
+ "),
+ workspaceKind: WorkspaceKind.Interactive,
+ exportProvider: exportProvider))
+ {
+ // Force initialization.
+ workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
+
+ var textView = workspace.Documents.Single().GetTextView();
+
+ var handler = new ChangeSignatureCommandHandler();
+ var delegatedToNext = false;
+ Func nextHandler = () =>
+ {
+ delegatedToNext = true;
+ return CommandState.Unavailable;
+ };
+
+ var state = handler.GetCommandState(new Commands.RemoveParametersCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+
+ delegatedToNext = false;
+ state = handler.GetCommandState(new Commands.ReorderParametersCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+ }
+ }
}
}
diff --git a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs
index ed86d4ef9e5c12f79dd76db574818655a30a0fd3..55dae47dc2e65d555836d18c0e7f6ef5fd7811c0 100644
--- a/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs
+++ b/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.cs
@@ -1,5 +1,13 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
+using System.Linq;
+using System.Xml.Linq;
+using Microsoft.CodeAnalysis.Editor.CSharp.EncapsulateField;
+using Microsoft.CodeAnalysis.Editor.Implementation.Interactive;
+using Microsoft.CodeAnalysis.Editor.UnitTests;
+using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
+using Microsoft.VisualStudio.Text.Operations;
using Roslyn.Test.Utilities;
using Xunit;
@@ -175,5 +183,44 @@ static void Main(string[] args)
state.AssertEncapsulateAs(expected);
}
}
+
+ [Fact]
+ [Trait(Traits.Feature, Traits.Features.EncapsulateField)]
+ [Trait(Traits.Feature, Traits.Features.Interactive)]
+ public void EncapsulateFieldCommandDisabledInSubmission()
+ {
+ var exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsCodeFixService)));
+
+ using (var workspace = TestWorkspaceFactory.CreateWorkspace(XElement.Parse(@"
+
+
+ class C
+ {
+ object $$foo;
+ }
+
+ "),
+ workspaceKind: WorkspaceKind.Interactive,
+ exportProvider: exportProvider))
+ {
+ // Force initialization.
+ workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
+
+ var textView = workspace.Documents.Single().GetTextView();
+
+ var handler = new EncapsulateFieldCommandHandler(workspace.GetService(), workspace.GetService());
+ var delegatedToNext = false;
+ Func nextHandler = () =>
+ {
+ delegatedToNext = true;
+ return CommandState.Unavailable;
+ };
+
+ var state = handler.GetCommandState(new Commands.EncapsulateFieldCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+ }
+ }
}
}
diff --git a/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
index d96d8284bb884da404638384b1ec75b2376995bb..da37aa4320830c35b71e78040f9ccf00db7579a2 100644
--- a/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
+++ b/src/EditorFeatures/CSharpTest/ExtractInterface/ExtractInterfaceTests.cs
@@ -1,8 +1,13 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Linq;
-using System.Threading;
+using System.Xml.Linq;
+using Microsoft.CodeAnalysis.Editor.CSharp.ExtractInterface;
+using Microsoft.CodeAnalysis.Editor.Implementation.Interactive;
+using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Editor.UnitTests.ExtractInterface;
+using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.ExtractInterface;
using Roslyn.Test.Utilities;
using Xunit;
@@ -1047,5 +1052,44 @@ class $$Test
var expectedTypeParameterSuffix = @"";
TestExtractInterfaceCommandCSharp(markup, expectedSuccess: true, expectedTypeParameterSuffix: expectedTypeParameterSuffix);
}
+
+ [Fact]
+ [Trait(Traits.Feature, Traits.Features.ExtractInterface)]
+ [Trait(Traits.Feature, Traits.Features.Interactive)]
+ public void ExtractInterfaceCommandDisabledInSubmission()
+ {
+ var exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsCodeFixService)));
+
+ using (var workspace = TestWorkspaceFactory.CreateWorkspace(XElement.Parse(@"
+
+
+ public class $$C
+ {
+ public void M() { }
+ }
+
+ "),
+ workspaceKind: WorkspaceKind.Interactive,
+ exportProvider: exportProvider))
+ {
+ // Force initialization.
+ workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
+
+ var textView = workspace.Documents.Single().GetTextView();
+
+ var handler = new ExtractInterfaceCommandHandler();
+ var delegatedToNext = false;
+ Func nextHandler = () =>
+ {
+ delegatedToNext = true;
+ return CommandState.Unavailable;
+ };
+
+ var state = handler.GetCommandState(new Commands.ExtractInterfaceCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+ }
+ }
}
}
diff --git a/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodTests.cs b/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodTests.cs
index 6979b59a189155c82883cfd4b5e5e25a086be046..b4b005979315bad1e54aa28a2f37b6fdbf23eca9 100644
--- a/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodTests.cs
+++ b/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodTests.cs
@@ -1,10 +1,18 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
+using System.Linq;
using System.Threading;
+using System.Xml.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.ExtractMethod;
+using Microsoft.CodeAnalysis.Editor.CSharp.ExtractMethod;
+using Microsoft.CodeAnalysis.Editor.Implementation.Interactive;
+using Microsoft.CodeAnalysis.Editor.UnitTests;
+using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.ExtractMethod;
using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Text.Operations;
using Roslyn.Test.Utilities;
using Xunit;
@@ -10221,6 +10229,46 @@ public void ExtractMethod_Argument2()
service.ExtractMethodAsync(document, default(TextSpan)).Wait();
}
+ [Fact]
+ [Trait(Traits.Feature, Traits.Features.ExtractMethod)]
+ [Trait(Traits.Feature, Traits.Features.Interactive)]
+ public void ExtractMethodCommandDisabledInSubmission()
+ {
+ var exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsCodeFixService)));
+
+ using (var workspace = TestWorkspaceFactory.CreateWorkspace(XElement.Parse(@"
+
+
+ typeof(string).$$Name
+
+ "),
+ workspaceKind: WorkspaceKind.Interactive,
+ exportProvider: exportProvider))
+ {
+ // Force initialization.
+ workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
+
+ var textView = workspace.Documents.Single().GetTextView();
+
+ var handler = new ExtractMethodCommandHandler(
+ workspace.GetService(),
+ workspace.GetService(),
+ workspace.GetService(),
+ workspace.GetService());
+ var delegatedToNext = false;
+ Func nextHandler = () =>
+ {
+ delegatedToNext = true;
+ return CommandState.Unavailable;
+ };
+
+ var state = handler.GetCommandState(new Commands.ExtractMethodCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+ }
+ }
+
private CSharpParseOptions Interactive
{
get
diff --git a/src/EditorFeatures/CSharpTest/Organizing/OrganizeTypeDeclarationTests.cs b/src/EditorFeatures/CSharpTest/Organizing/OrganizeTypeDeclarationTests.cs
index 23a8de8b27efcf49a7f3e1513fe62404d87886dd..2ac03a931ba11c4b5966ae1b283db25e1f77afc2 100644
--- a/src/EditorFeatures/CSharpTest/Organizing/OrganizeTypeDeclarationTests.cs
+++ b/src/EditorFeatures/CSharpTest/Organizing/OrganizeTypeDeclarationTests.cs
@@ -1,6 +1,14 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
+using System.Linq;
+using System.Xml.Linq;
+using Microsoft.CodeAnalysis.Editor.Implementation.Interactive;
+using Microsoft.CodeAnalysis.Editor.Implementation.Organizing;
+using Microsoft.CodeAnalysis.Editor.UnitTests;
+using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Text.Operations;
using Roslyn.Test.Utilities;
using Xunit;
@@ -1062,5 +1070,59 @@ void B()
}";
Check(initial, final);
}
+
+ [Fact]
+ [Trait(Traits.Feature, Traits.Features.Organizing)]
+ [Trait(Traits.Feature, Traits.Features.Interactive)]
+ public void OrganizingCommandsDisabledInSubmission()
+ {
+ var exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsCodeFixService)));
+
+ using (var workspace = TestWorkspaceFactory.CreateWorkspace(XElement.Parse(@"
+
+
+ class C
+ {
+ object $$foo;
+ }
+
+ "),
+ workspaceKind: WorkspaceKind.Interactive,
+ exportProvider: exportProvider))
+ {
+ // Force initialization.
+ workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();
+
+ var textView = workspace.Documents.Single().GetTextView();
+
+ var handler = new OrganizeDocumentCommandHandler(workspace.GetService());
+ var delegatedToNext = false;
+ Func nextHandler = () =>
+ {
+ delegatedToNext = true;
+ return CommandState.Unavailable;
+ };
+
+ var state = handler.GetCommandState(new Commands.SortImportsCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+
+ delegatedToNext = false;
+ state = handler.GetCommandState(new Commands.SortAndRemoveUnnecessaryImportsCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+
+ delegatedToNext = false;
+ state = handler.GetCommandState(new Commands.RemoveUnnecessaryImportsCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+
+ delegatedToNext = false;
+ state = handler.GetCommandState(new Commands.OrganizeDocumentCommandArgs(textView, textView.TextBuffer), nextHandler);
+ Assert.True(delegatedToNext);
+ Assert.False(state.IsAvailable);
+ }
+ }
}
}
diff --git a/src/EditorFeatures/Test2/EditorServicesTest2.vbproj b/src/EditorFeatures/Test2/EditorServicesTest2.vbproj
index 21e78d2ab3bd877acb2a06315514e9b1ec888a33..0c153d636406360c11b572edc57f1b30486c22b5 100644
--- a/src/EditorFeatures/Test2/EditorServicesTest2.vbproj
+++ b/src/EditorFeatures/Test2/EditorServicesTest2.vbproj
@@ -37,6 +37,10 @@
{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}
BasicCodeAnalysis
+
+ {92412d1a-0f23-45b5-b196-58839c524917}
+ InteractiveEditorFeatures
+
{76C6F005-C89D-4348-BB4A-391898DBEB52}
TestUtilities.Desktop
diff --git a/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb b/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb
index 0266538eab9a82fe1094a1eef36442600a3f9ffb..addf594a109cc2b59bb371fde6b127f6d4f13c63 100644
--- a/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb
+++ b/src/EditorFeatures/Test2/Rename/RenameCommandHandlerTests.vb
@@ -4,6 +4,7 @@ Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Editor.Commands
Imports Microsoft.CodeAnalysis.Editor.Host
Imports Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
Imports Microsoft.CodeAnalysis.Editor.Shared.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Text.Shared.Extensions
@@ -43,6 +44,41 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
End Using
End Sub
+
+
+
+ Public Sub RenameCommandDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ object $$foo;
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = CreateCommandHandler(workspace)
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New RenameCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
+
Public Sub RenameCommandWithSelectionDoesNotSelect()
diff --git a/src/EditorFeatures/TestUtilities/Traits.cs b/src/EditorFeatures/TestUtilities/Traits.cs
index e7cadf805ad8993c530a9670c3fdd550ff30224a..c425a45456219ac2fb655df93387ac67dd7e9ae0 100644
--- a/src/EditorFeatures/TestUtilities/Traits.cs
+++ b/src/EditorFeatures/TestUtilities/Traits.cs
@@ -93,6 +93,7 @@ public static class Features
public const string F1Help = "F1Help";
public const string Formatting = "Formatting";
public const string GoToDefinition = "GoToDefinition";
+ public const string Interactive = "Interactive";
public const string InteractiveHost = "InteractiveHost";
public const string KeywordHighlighting = "KeywordHighlighting";
public const string KeywordRecommending = "KeywordRecommending";
diff --git a/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj b/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj
index 5f4b4ddfd9f2fa9467543fbb636042e55f6fc13d..7eb1e416ecbe90bd897f898ccab5c22a79ede15e 100644
--- a/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj
+++ b/src/EditorFeatures/VisualBasicTest/BasicEditorServicesTest.vbproj
@@ -35,6 +35,10 @@
{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}
BasicCodeAnalysis
+
+ {92412d1a-0f23-45b5-b196-58839c524917}
+ InteractiveEditorFeatures
+
{76C6F005-C89D-4348-BB4A-391898DBEB52}
TestUtilities.Desktop
diff --git a/src/EditorFeatures/VisualBasicTest/ChangeSignature/RemoveParametersTests.vb b/src/EditorFeatures/VisualBasicTest/ChangeSignature/RemoveParametersTests.vb
index 39da4accc35f5329d8663dd81fb6adc4e00c54c1..f4e593a4b692f2804ff375feeb2a7289a1550c19 100644
--- a/src/EditorFeatures/VisualBasicTest/ChangeSignature/RemoveParametersTests.vb
+++ b/src/EditorFeatures/VisualBasicTest/ChangeSignature/RemoveParametersTests.vb
@@ -1,7 +1,11 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
+Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
+Imports Microsoft.CodeAnalysis.Editor.VisualBasic.ChangeSignature
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ChangeSignature
Partial Public Class ChangeSignatureTests
@@ -85,5 +89,48 @@ End Module
TestChangeSignatureViaCommand(LanguageNames.VisualBasic, markup, updatedSignature:=permutation, expectedUpdatedInvocationDocumentCode:=updatedCode)
End Sub
+
+
+
+
+ Public Sub ChangeSignatureCommandDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ Class C
+ Sub M$$(x As Integer)
+ End Sub
+ End Class
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = New ChangeSignatureCommandHandler()
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New Commands.ReorderParametersCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+
+ delegatedToNext = False
+ state = handler.GetCommandState(New Commands.RemoveParametersCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
End Class
End Namespace
diff --git a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb
index e63ecd0627fbbc5c45c5e42419ecf853bf396405..47d3ea4290950e9d959ae25ed236d54022bf3f9e 100644
--- a/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb
+++ b/src/EditorFeatures/VisualBasicTest/EncapsulateField/EncapsulateFieldCommandHandlerTests.vb
@@ -1,6 +1,11 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+Imports Microsoft.CodeAnalysis.Editor.UnitTests
+Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
+Imports Microsoft.CodeAnalysis.Editor.VisualBasic.EncapsulateField
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests
+Imports Microsoft.VisualStudio.Text.Operations
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EncapsulateField
Public Class EncapsulateFieldCommandHandlerTests
@@ -120,5 +125,42 @@ End Class
state.AssertEncapsulateAs(expected)
End Using
End Sub
+
+
+
+
+ Public Sub EncapsulateFieldCommandDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ Class C
+ Private $foo As Object
+ End Class
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = New EncapsulateFieldCommandHandler(workspace.GetService(Of Host.IWaitIndicator), workspace.GetService(Of ITextBufferUndoManagerProvider))
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New Commands.EncapsulateFieldCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
End Class
End Namespace
diff --git a/src/EditorFeatures/VisualBasicTest/ExtractInterface/ExtractInterfaceTests.vb b/src/EditorFeatures/VisualBasicTest/ExtractInterface/ExtractInterfaceTests.vb
index cffdf0ae0c1ff4cb3471d3180346c5ea327fe0ea..296884668a8653ad141a5c6670dde461723d571c 100644
--- a/src/EditorFeatures/VisualBasicTest/ExtractInterface/ExtractInterfaceTests.vb
+++ b/src/EditorFeatures/VisualBasicTest/ExtractInterface/ExtractInterfaceTests.vb
@@ -1,8 +1,11 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.ExtractInterface
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
+Imports Microsoft.CodeAnalysis.Editor.VisualBasic.ExtractInterface
Imports Microsoft.CodeAnalysis.ExtractInterface
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ExtractInterface
@@ -1249,6 +1252,44 @@ End Namespace
rootNamespace:="RootNamespace")
End Sub
+
+
+
+ Public Sub ExtractInterfaceCommandDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ Public Class C
+ Public Sub M()
+ End Sub
+ End Class
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = New ExtractInterfaceCommandHandler()
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New Commands.ExtractInterfaceCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
+
Private Shared Sub TestTypeDiscovery(markup As String, typeDiscoveryRule As TypeDiscoveryRule, expectedExtractable As Boolean)
Using testState = New ExtractInterfaceTestState(markup, LanguageNames.VisualBasic, compilationOptions:=Nothing)
Dim result = testState.GetTypeAnalysisResult(typeDiscoveryRule)
diff --git a/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb b/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb
index 4e8ddc453e91dd1a368799df3670227ea21cc5d5..57cc38744fe48fb506825510e8057520214fb2be 100644
--- a/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb
+++ b/src/EditorFeatures/VisualBasicTest/ExtractMethod/ExtractMethodTests.LanguageInteraction.vb
@@ -1,6 +1,11 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+Imports Microsoft.CodeAnalysis.Editor.UnitTests
+Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
+Imports Microsoft.CodeAnalysis.Editor.VisualBasic.ExtractMethod
Imports Microsoft.CodeAnalysis.Text
+Imports Microsoft.VisualStudio.Text.Operations
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ExtractMethod
@@ -3358,6 +3363,45 @@ End Namespace"
TestExtractMethod(code, expected)
End Sub
+
+
+
+ Public Sub ExtractMethodCommandDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ GetType(String).$$Name
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = New ExtractMethodCommandHandler(
+ workspace.GetService(Of ITextBufferUndoManagerProvider)(),
+ workspace.GetService(Of IEditorOperationsFactoryService)(),
+ workspace.GetService(Of IInlineRenameService)(),
+ workspace.GetService(Of Host.IWaitIndicator)())
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New Commands.ExtractMethodCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
+
End Class
End Class
End Namespace
\ No newline at end of file
diff --git a/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeTypeDeclarationTests.vb b/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeTypeDeclarationTests.vb
index f71046d10f1db9e63c8dd3019eab5518333b4de0..e49a0cafb54146928969ed9cb3545bbfb50884fc 100644
--- a/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeTypeDeclarationTests.vb
+++ b/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeTypeDeclarationTests.vb
@@ -5,6 +5,10 @@ Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+Imports Microsoft.CodeAnalysis.Editor.Implementation.Organizing
+Imports Microsoft.CodeAnalysis.Editor.UnitTests
+Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Imports Roslyn.Test.EditorUtilities
@@ -939,5 +943,57 @@ End Namespace
End Namespace
Check(initial, final)
End Sub
+
+
+
+
+ Public Sub OrganizingCommandsDisabledInSubmission()
+ Dim exportProvider = MinimalTestExportProvider.CreateExportProvider(
+ TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveDocumentSupportsCodeFixService)))
+
+ Using workspace = TestWorkspaceFactory.CreateWorkspace(
+
+
+ Class C
+ Private $foo As Object
+ End Class
+
+ ,
+ workspaceKind:=WorkspaceKind.Interactive,
+ exportProvider:=exportProvider)
+
+ ' Force initialization.
+ workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
+
+ Dim textView = workspace.Documents.Single().GetTextView()
+
+ Dim handler = New OrganizeDocumentCommandHandler(workspace.GetService(Of Host.IWaitIndicator))
+ Dim delegatedToNext = False
+ Dim nextHandler =
+ Function()
+ delegatedToNext = True
+ Return CommandState.Unavailable
+ End Function
+
+ Dim state = handler.GetCommandState(New Commands.SortImportsCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+
+ delegatedToNext = False
+ state = handler.GetCommandState(New Commands.SortAndRemoveUnnecessaryImportsCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+
+ delegatedToNext = False
+ state = handler.GetCommandState(New Commands.RemoveUnnecessaryImportsCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+
+ delegatedToNext = False
+ state = handler.GetCommandState(New Commands.OrganizeDocumentCommandArgs(textView, textView.TextBuffer), nextHandler)
+ Assert.True(delegatedToNext)
+ Assert.False(state.IsAvailable)
+ End Using
+ End Sub
End Class
End Namespace
diff --git a/src/Interactive/EditorFeatures/Core/Implementation/Interactive/InteractiveDocumentSupportsSuggestionService.cs b/src/Interactive/EditorFeatures/Core/Implementation/Interactive/InteractiveDocumentSupportsSuggestionService.cs
new file mode 100644
index 0000000000000000000000000000000000000000..764b45d14671f6a9444cea8fc3e3b35c09d594ef
--- /dev/null
+++ b/src/Interactive/EditorFeatures/Core/Implementation/Interactive/InteractiveDocumentSupportsSuggestionService.cs
@@ -0,0 +1,27 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Composition;
+using Microsoft.CodeAnalysis.Editor.Shared.SuggestionSupport;
+using Microsoft.CodeAnalysis.Host.Mef;
+
+namespace Microsoft.CodeAnalysis.Editor.Implementation.Interactive
+{
+ [ExportWorkspaceService(typeof(IDocumentSupportsSuggestionService), WorkspaceKind.Interactive), Shared]
+ internal sealed class InteractiveDocumentSupportsCodeFixService : IDocumentSupportsSuggestionService
+ {
+ public bool SupportsCodeFixes(Document document)
+ {
+ return false;
+ }
+
+ public bool SupportsRefactorings(Document document)
+ {
+ return false;
+ }
+
+ public bool SupportsRename(Document document)
+ {
+ return false;
+ }
+ }
+}
diff --git a/src/Interactive/EditorFeatures/Core/InteractiveEditorFeatures.csproj b/src/Interactive/EditorFeatures/Core/InteractiveEditorFeatures.csproj
index 7d89c468c3930e4b823671148c1ac35143517796..f6fe6ca591e9c4d1b6553bdaed9a707a83f0ca8a 100644
--- a/src/Interactive/EditorFeatures/Core/InteractiveEditorFeatures.csproj
+++ b/src/Interactive/EditorFeatures/Core/InteractiveEditorFeatures.csproj
@@ -142,6 +142,7 @@
+