-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
317 additions
and
46 deletions.
There are no files selected for viewing
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
58 changes: 58 additions & 0 deletions
58
src/EditorFeatures/Core/ExternalAccess/IntelliCode/Api/IIntelliCodeArgumentDefaultsSource.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,58 @@ | ||
// 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.Collections.Immutable; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
using Microsoft.VisualStudio.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.IntelliCode.Api | ||
{ | ||
/// <summary> | ||
/// Provides a list of possible default arguments for method calls. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is a MEF component and should be exported with <see cref="ContentTypeAttribute"/> and <see cref="NameAttribute"/> attributes | ||
/// and optional <see cref="OrderAttribute"/> and <see cref="TextViewRoleAttribute"/> attributes. | ||
/// An instance of <see cref="IIntelliCodeArgumentDefaultsSource"/> is selected | ||
/// first by matching ContentType with content type of the <see cref="ITextView.TextBuffer"/>, and then by order. | ||
/// Only one <see cref="IIntelliCodeArgumentDefaultsSource"/> is used in a given view. | ||
/// <para> | ||
/// Only one <see cref="IIntelliCodeArgumentDefaultsSource"/> will used for any given <see cref="ITextView"/>. The sources are | ||
/// ordered by the Order attribute. The first source (if any) that satisfies the ContentType and TextViewRoles | ||
/// attributes will be the source used to provide defaults. | ||
/// </para> | ||
/// <example> | ||
/// <code> | ||
/// [Export(typeof(IIntelliCodeArgumentDefaultsSource))] | ||
/// [Name(nameof(IntelliCodeArgumentDefaultsSource))] | ||
/// [ContentType("text")] | ||
/// [TextViewRoles(PredefinedTextViewRoles.Editable)] | ||
/// [Order(Before = "OtherCompletionDefaultsSource")] | ||
/// public class IntelliCodeArgumentDefaultsSource : IIntelliCodeArgumentDefaultsSource | ||
/// </code> | ||
/// </example> | ||
/// </remarks> | ||
internal interface IIntelliCodeArgumentDefaultsSource | ||
{ | ||
/// <summary> | ||
/// Gets a list of possible default arguments for a method signature. | ||
/// </summary> | ||
/// <param name="view">View for which the defaults are desired.</param> | ||
/// <returns>A list of possible default arguments for a method signature.</returns> | ||
/// <remarks> | ||
/// <para>The returned value will always be in the form of a "complete" set of arguments, including the leading and trailing parenthesis.</para> | ||
/// <para>For example: | ||
/// <code> | ||
/// () | ||
/// (args[0]) | ||
/// (args.Length) | ||
/// (value: args.Length) | ||
/// </code> | ||
/// </para> | ||
/// <para>Some of the proposals may be syntactically/semantically invalid (and can be ignored by the caller).</para> | ||
/// </remarks> | ||
Task<ImmutableArray<string>> GetArgumentDefaultsAsync(ITextView view); | ||
} | ||
} |
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
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
16 changes: 16 additions & 0 deletions
16
src/Features/Core/Portable/ExternalAccess/IntelliCode/Api/IntelliCodeCompletionOptions.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,16 @@ | ||
// 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.CodeAnalysis.Completion; | ||
using Microsoft.CodeAnalysis.Options; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.IntelliCode.Api | ||
{ | ||
internal static class IntelliCodeCompletionOptions | ||
{ | ||
public static PerLanguageOption<bool> TriggerOnTyping { get; } = (PerLanguageOption<bool>)CompletionOptions.TriggerOnTyping; | ||
|
||
public static PerLanguageOption<bool> TriggerOnTypingLetters { get; } = (PerLanguageOption<bool>)CompletionOptions.TriggerOnTypingLetters2; | ||
} | ||
} |
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
Oops, something went wrong.