diff --git a/eng/Versions.props b/eng/Versions.props
index 59017cb7ada3d..d35c4c3ba7663 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -25,10 +25,11 @@
0.1.132-beta
4.2.0-2.final
- 17.2.3194
+ 17.3.37-preview
5.0.0-alpha1.19409.1
5.0.0-preview.1.20112.8
- 17.3.15
+ 17.3.2062-preview
+ 17.3.2017
17.2.32505.113
16.5.0
-
-
-
-
-
-
-
+
diff --git a/src/EditorFeatures/Core/Snippets/RoslynLSPSnippetExpander.cs b/src/EditorFeatures/Core/Snippets/RoslynLSPSnippetExpander.cs
deleted file mode 100644
index 49bc122b5ab37..0000000000000
--- a/src/EditorFeatures/Core/Snippets/RoslynLSPSnippetExpander.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Reflection;
-using System.Text;
-using Microsoft.CodeAnalysis.ErrorReporting;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.LanguageServer;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.LanguageServer.Protocol;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-using Roslyn.Utilities;
-
-namespace Microsoft.CodeAnalysis.Snippets
-{
- [Export(typeof(IRoslynLSPSnippetExpander))]
- [Export(typeof(RoslynLSPSnippetExpander))]
- internal class RoslynLSPSnippetExpander : IRoslynLSPSnippetExpander
- {
- private readonly object? _lspSnippetExpander;
- private readonly Type? _expanderType;
- private readonly MethodInfo? _expanderMethodInfo;
-
- [ImportingConstructor]
- [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
- public RoslynLSPSnippetExpander(
- [Import("Microsoft.VisualStudio.LanguageServer.Client.Snippets.LanguageServerSnippetExpander", AllowDefault = true)] object? languageServerSnippetExpander)
- {
- _lspSnippetExpander = languageServerSnippetExpander;
-
- if (_lspSnippetExpander is not null)
- {
- _expanderType = _lspSnippetExpander.GetType();
- _expanderMethodInfo = _expanderType.GetMethod("TryExpand");
- }
- }
-
- public void Expand(TextSpan textSpan, string lspSnippetText, ITextView textView, ITextSnapshot textSnapshot)
- {
- Contract.ThrowIfFalse(CanExpandSnippet());
-
- var textEdit = new TextEdit()
- {
- Range = ProtocolConversions.TextSpanToRange(textSpan, textSnapshot.AsText()),
- NewText = lspSnippetText
- };
-
- try
- {
- // ExpanderMethodInfo should not be null at this point.
- var expandMethodResult = _expanderMethodInfo!.Invoke(_lspSnippetExpander, new object[] { textEdit, textView, textSnapshot });
- if (expandMethodResult is not bool resultValue)
- {
- throw new Exception("The result of the invoked LSP snippet expander was not a boolean.");
- }
-
- if (!resultValue)
- {
- throw new Exception("The invoked LSP snippet expander came back as false.");
- }
- }
- catch (Exception e) when (FatalError.ReportAndCatch(e))
- {
- }
- }
-
- public bool CanExpandSnippet()
- {
- return _expanderMethodInfo is not null;
- }
- }
-}
diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/Snippets/CSharpSnippetCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/Snippets/CSharpSnippetCompletionProvider.cs
index 000e66025c4d7..cb1c3932f6707 100644
--- a/src/Features/CSharp/Portable/Completion/CompletionProviders/Snippets/CSharpSnippetCompletionProvider.cs
+++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/Snippets/CSharpSnippetCompletionProvider.cs
@@ -19,8 +19,7 @@ internal class CSharpSnippetCompletionProvider : AbstractSnippetCompletionProvid
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
- public CSharpSnippetCompletionProvider(IRoslynLSPSnippetExpander roslynLSPSnippetExpander)
- : base(roslynLSPSnippetExpander)
+ public CSharpSnippetCompletionProvider()
{
}
}
diff --git a/src/Features/Core/Portable/Completion/Providers/Snippets/AbstractSnippetCompletionProvider.cs b/src/Features/Core/Portable/Completion/Providers/Snippets/AbstractSnippetCompletionProvider.cs
index 6787d2b7f3b61..1fb8725ea8f19 100644
--- a/src/Features/Core/Portable/Completion/Providers/Snippets/AbstractSnippetCompletionProvider.cs
+++ b/src/Features/Core/Portable/Completion/Providers/Snippets/AbstractSnippetCompletionProvider.cs
@@ -18,13 +18,6 @@ namespace Microsoft.CodeAnalysis.Completion.Providers.Snippets
{
internal abstract class AbstractSnippetCompletionProvider : CompletionProvider
{
- private readonly IRoslynLSPSnippetExpander _roslynLSPSnippetExpander;
-
- public AbstractSnippetCompletionProvider(IRoslynLSPSnippetExpander roslynLSPSnippetExpander)
- {
- _roslynLSPSnippetExpander = roslynLSPSnippetExpander;
- }
-
public override async Task GetChangeAsync(Document document, CompletionItem item, char? commitKey = null, CancellationToken cancellationToken = default)
{
// This retrieves the document without the text used to invoke completion
@@ -58,32 +51,29 @@ public override async Task GetChangeAsync(Document document, C
public override async Task ProvideCompletionsAsync(CompletionContext context)
{
- if (_roslynLSPSnippetExpander.CanExpandSnippet())
+ var document = context.Document;
+ var cancellationToken = context.CancellationToken;
+ var position = context.Position;
+ var service = document.GetLanguageService();
+
+ if (service == null)
+ {
+ return;
+ }
+
+ var (strippedDocument, newPosition) = await GetDocumentWithoutInvokingTextAsync(document, position, cancellationToken).ConfigureAwait(false);
+
+ var snippets = await service.GetSnippetsAsync(strippedDocument, newPosition, cancellationToken).ConfigureAwait(false);
+
+ foreach (var snippetData in snippets)
{
- var document = context.Document;
- var cancellationToken = context.CancellationToken;
- var position = context.Position;
- var service = document.GetLanguageService();
-
- if (service == null)
- {
- return;
- }
-
- var (strippedDocument, newPosition) = await GetDocumentWithoutInvokingTextAsync(document, position, cancellationToken).ConfigureAwait(false);
-
- var snippets = await service.GetSnippetsAsync(strippedDocument, newPosition, cancellationToken).ConfigureAwait(false);
-
- foreach (var snippetData in snippets)
- {
- var completionItem = SnippetCompletionItem.Create(
- displayText: snippetData.DisplayName,
- displayTextSuffix: "",
- position: position,
- snippetIdentifier: snippetData.SnippetIdentifier,
- glyph: Glyph.Snippet);
- context.AddItem(completionItem);
- }
+ var completionItem = SnippetCompletionItem.Create(
+ displayText: snippetData.DisplayName,
+ displayTextSuffix: "",
+ position: position,
+ snippetIdentifier: snippetData.SnippetIdentifier,
+ glyph: Glyph.Snippet);
+ context.AddItem(completionItem);
}
}
diff --git a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
index 0b8da261489bc..d1bcdd785c163 100644
--- a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
+++ b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs
@@ -146,7 +146,7 @@ public async Task SetSessionAsync(CollaborationSession session)
/// this means that the remote workpace roots have also changed and need to be updated.
/// This will not be called concurrently.
///
- private async Task OnActiveWorkspaceChangedAsync(object sender, EventArgs args)
+ private async Task OnActiveWorkspaceChangedAsync(object? sender, EventArgs args)
{
if (IsRemoteSession)
{