-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement an adapter interface to access LanguageServerSnippetExpande…
…r via the EditorFeatures layer
- Loading branch information
Showing
4 changed files
with
50 additions
and
8 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/EditorFeatures/Core.Wpf/AsyncCompletion/LanguageServerSnippetExpanderAdapter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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.Composition; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
using Microsoft.VisualStudio.LanguageServer.Client.Snippets; | ||
using Microsoft.VisualStudio.Text; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion | ||
{ | ||
[Export(typeof(ILanguageServerSnippetExpander))] | ||
[Shared] | ||
internal sealed class LanguageServerSnippetExpanderAdapter : ILanguageServerSnippetExpander | ||
{ | ||
private readonly LanguageServerSnippetExpander _languageServerSnippetExpander; | ||
|
||
[ImportingConstructor] | ||
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] | ||
public LanguageServerSnippetExpanderAdapter(LanguageServerSnippetExpander languageServerSnippetExpander) | ||
{ | ||
_languageServerSnippetExpander = languageServerSnippetExpander; | ||
} | ||
|
||
public bool TryExpand(string lspSnippetText, SnapshotSpan snapshotSpan, ITextView textView) | ||
=> _languageServerSnippetExpander.TryExpand(lspSnippetText, snapshotSpan, textView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ILanguageServerSnippetExpander.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 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 Microsoft.VisualStudio.Text; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion | ||
{ | ||
internal interface ILanguageServerSnippetExpander | ||
{ | ||
bool TryExpand(string lspSnippetText, SnapshotSpan snapshotSpan, ITextView textView); | ||
} | ||
} |