Skip to content

Commit 3eb8d3f

Browse files
authored
Revert "OmniSharp options (dotnet#58208)"
This reverts commit f473056.
1 parent 709d483 commit 3eb8d3f

39 files changed

Lines changed: 175 additions & 283 deletions

File tree

src/EditorFeatures/CSharpTest/ImplementAbstractClass/ImplementAbstractClassTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ class Derived : Base
14881488
void Goo() { }
14891489
14901490
public override int Prop => throw new System.NotImplementedException();
1491-
}", options: Option(ImplementTypeOptions.Metadata.InsertionBehavior, ImplementTypeInsertionBehavior.AtTheEnd));
1491+
}", options: Option(ImplementTypeOptions.InsertionBehavior, ImplementTypeInsertionBehavior.AtTheEnd));
14921492
}
14931493

14941494
[WorkItem(17274, "https://github.com/dotnet/roslyn/issues/17274")]
@@ -1665,7 +1665,7 @@ class C : AbstractClass
16651665
public override int ReadWriteProp { get; set; }
16661666
public override int WriteOnlyProp { set => throw new System.NotImplementedException(); }
16671667
}", parameters: new TestParameters(options: Option(
1668-
ImplementTypeOptions.Metadata.PropertyGenerationBehavior,
1668+
ImplementTypeOptions.PropertyGenerationBehavior,
16691669
ImplementTypePropertyGenerationBehavior.PreferAutoProperties)));
16701670
}
16711671

src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7287,7 +7287,7 @@ void M() { }
72877287
}",
72887288
Options =
72897289
{
7290-
{ ImplementTypeOptions.Metadata.InsertionBehavior, ImplementTypeInsertionBehavior.AtTheEnd },
7290+
{ ImplementTypeOptions.InsertionBehavior, ImplementTypeInsertionBehavior.AtTheEnd },
72917291
},
72927292
}.RunAsync();
72937293
}
@@ -7462,7 +7462,7 @@ class Class : IInterface
74627462
}",
74637463
Options =
74647464
{
7465-
{ ImplementTypeOptions.Metadata.PropertyGenerationBehavior, ImplementTypePropertyGenerationBehavior.PreferAutoProperties },
7465+
{ ImplementTypeOptions.PropertyGenerationBehavior, ImplementTypePropertyGenerationBehavior.PreferAutoProperties },
74667466
},
74677467
}.RunAsync();
74687468
}

src/EditorFeatures/CSharpTest/Structure/MetadataAsSource/InvalidIdentifierStructureTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public class InvalidIdentifierStructureTests : AbstractSyntaxStructureProviderTe
2929
internal override async Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position)
3030
{
3131
var outliningService = document.GetLanguageService<BlockStructureService>();
32-
var options = BlockStructureOptions.From(document.Project);
33-
return (await outliningService.GetBlockStructureAsync(document, options, CancellationToken.None)).Spans;
32+
33+
return (await outliningService.GetBlockStructureAsync(document, CancellationToken.None)).Spans;
3434
}
3535

3636
[WorkItem(1174405, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174405")]

src/EditorFeatures/Core/Implementation/Structure/AbstractStructureTaggerProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ protected sealed override async Task ProduceTagsAsync(
143143
if (outliningService == null)
144144
return;
145145

146-
var options = BlockStructureOptions.From(document.Project);
147146
var blockStructure = await outliningService.GetBlockStructureAsync(
148-
documentSnapshotSpan.Document, options, cancellationToken).ConfigureAwait(false);
147+
documentSnapshotSpan.Document, cancellationToken).ConfigureAwait(false);
149148

150149
ProcessSpans(
151150
context, documentSnapshotSpan.SnapshotSpan, outliningService,

src/EditorFeatures/Test/Structure/BlockStructureServiceTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ private static async Task<ImmutableArray<BlockSpan>> GetSpansFromWorkspaceAsync(
9797
var hostDocument = workspace.Documents.First();
9898
var document = workspace.CurrentSolution.GetDocument(hostDocument.Id);
9999
var outliningService = document.GetLanguageService<BlockStructureService>();
100-
var options = BlockStructureOptions.From(document.Project);
101100

102-
var structure = await outliningService.GetBlockStructureAsync(document, options, CancellationToken.None);
101+
var structure = await outliningService.GetBlockStructureAsync(document, CancellationToken.None);
103102
return structure.Spans;
104103
}
105104
}

src/EditorFeatures/VisualBasic/ImplementAbstractClass/ImplementAbstractClassCommandHandler.vb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Imports System.Diagnostics.CodeAnalysis
77
Imports System.Threading
88
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
99
Imports Microsoft.CodeAnalysis.ImplementAbstractClass
10-
Imports Microsoft.CodeAnalysis.ImplementType
1110
Imports Microsoft.CodeAnalysis.Options
1211
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
1312
Imports Microsoft.VisualStudio.Commanding
@@ -33,22 +32,21 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.ImplementAbstractClass
3332

3433
Protected Overrides Function TryGetNewDocument(
3534
document As Document,
36-
options As ImplementTypeOptions,
37-
TypeSyntax As TypeSyntax,
35+
typeSyntax As TypeSyntax,
3836
cancellationToken As CancellationToken
3937
) As Document
4038

41-
If TypeSyntax.Parent.Kind <> SyntaxKind.InheritsStatement Then
39+
If typeSyntax.Parent.Kind <> SyntaxKind.InheritsStatement Then
4240
Return Nothing
4341
End If
4442

45-
Dim classBlock = TryCast(TypeSyntax.Parent.Parent, ClassBlockSyntax)
43+
Dim classBlock = TryCast(typeSyntax.Parent.Parent, ClassBlockSyntax)
4644
If classBlock Is Nothing Then
4745
Return Nothing
4846
End If
4947

5048
Dim updatedDocument = ImplementAbstractClassData.TryImplementAbstractClassAsync(
51-
document, classBlock, classBlock.ClassStatement.Identifier, options, cancellationToken).WaitAndGetResult(cancellationToken)
49+
document, classBlock, classBlock.ClassStatement.Identifier, cancellationToken).WaitAndGetResult(cancellationToken)
5250
If updatedDocument IsNot Nothing AndAlso
5351
updatedDocument.GetTextChangesAsync(document, cancellationToken).WaitAndGetResult(cancellationToken).Count = 0 Then
5452
Return Nothing

src/EditorFeatures/VisualBasic/ImplementInterface/ImplementInterfaceCommandHandler.vb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Imports System.Diagnostics.CodeAnalysis
77
Imports System.Threading
88
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
99
Imports Microsoft.CodeAnalysis.ImplementInterface
10-
Imports Microsoft.CodeAnalysis.ImplementType
1110
Imports Microsoft.CodeAnalysis.Options
1211
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
1312
Imports Microsoft.VisualStudio.Commanding
@@ -33,7 +32,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.ImplementInterface
3332

3433
Protected Overrides Function TryGetNewDocument(
3534
document As Document,
36-
options As ImplementTypeOptions,
3735
typeSyntax As TypeSyntax,
3836
cancellationToken As CancellationToken
3937
) As Document
@@ -45,7 +43,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.ImplementInterface
4543
Dim service = document.GetLanguageService(Of IImplementInterfaceService)()
4644
Dim updatedDocument = service.ImplementInterfaceAsync(
4745
document,
48-
options,
4946
typeSyntax.Parent,
5047
cancellationToken).WaitAndGetResult(cancellationToken)
5148
If updatedDocument.GetTextChangesAsync(document, cancellationToken).WaitAndGetResult(cancellationToken).Count = 0 Then

src/EditorFeatures/VisualBasic/Utilities/CommandHandlers/AbstractImplementAbstractClassOrInterfaceCommandHandler.vb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Imports System.Threading
66
Imports Microsoft.CodeAnalysis
77
Imports Microsoft.CodeAnalysis.Editor.Implementation.EndConstructGeneration
88
Imports Microsoft.CodeAnalysis.Formatting
9-
Imports Microsoft.CodeAnalysis.ImplementType
109
Imports Microsoft.CodeAnalysis.Options
1110
Imports Microsoft.CodeAnalysis.Simplification
1211
Imports Microsoft.CodeAnalysis.Text
@@ -39,7 +38,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
3938

4039
Protected MustOverride Overloads Function TryGetNewDocument(
4140
document As Document,
42-
options As ImplementTypeOptions,
4341
typeSyntax As TypeSyntax,
4442
cancellationToken As CancellationToken) As Document
4543

@@ -106,6 +104,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
106104
End Function
107105

108106
Private Overloads Function TryExecute(args As ReturnKeyCommandArgs, cancellationToken As CancellationToken) As Boolean
107+
Dim textSnapshot = args.SubjectBuffer.CurrentSnapshot
108+
Dim text = textSnapshot.AsText()
109+
110+
Dim document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges()
111+
If document Is Nothing Then
112+
Return False
113+
End If
114+
109115
If Not _globalOptions.GetOption(FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers, LanguageNames.VisualBasic) Then
110116
Return False
111117
End If
@@ -120,15 +126,8 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
120126
Return False
121127
End If
122128

123-
Dim textSnapshot = args.SubjectBuffer.CurrentSnapshot
124-
Dim document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges()
125-
If document Is Nothing Then
126-
Return False
127-
End If
128-
129129
Dim syntaxRoot = document.GetSyntaxRootSynchronously(cancellationToken)
130130
Dim token = syntaxRoot.FindTokenOnLeftOfPosition(caretPosition)
131-
Dim text = textSnapshot.AsText()
132131

133132
If text.Lines.IndexOf(token.SpanStart) <> text.Lines.IndexOf(caretPosition) Then
134133
Return False
@@ -163,8 +162,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities.CommandHandlers
163162
Return False
164163
End If
165164

166-
Dim options = ImplementTypeOptions.From(document.Project)
167-
Dim newDocument = TryGetNewDocument(document, options, identifier, cancellationToken)
165+
Dim newDocument = TryGetNewDocument(document, identifier, cancellationToken)
168166

169167
If newDocument Is Nothing Then
170168
Return False

src/EditorFeatures/VisualBasicTest/ImplementAbstractClass/ImplementAbstractClassTests.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ Class C
631631
End Set
632632
End Property
633633
End Class", parameters:=New TestParameters(options:=[Option](
634-
ImplementTypeOptions.Metadata.PropertyGenerationBehavior,
634+
ImplementTypeOptions.PropertyGenerationBehavior,
635635
ImplementTypePropertyGenerationBehavior.PreferAutoProperties)))
636636
End Function
637637
End Class

src/EditorFeatures/VisualBasicTest/ImplementInterface/ImplementInterfaceTests.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4647,7 +4647,7 @@ class Class
46474647
End Set
46484648
End Property
46494649
end class", parameters:=New TestParameters(options:=[Option](
4650-
ImplementTypeOptions.Metadata.PropertyGenerationBehavior,
4650+
ImplementTypeOptions.PropertyGenerationBehavior,
46514651
ImplementTypePropertyGenerationBehavior.PreferAutoProperties)))
46524652
End Function
46534653
End Class

0 commit comments

Comments
 (0)