Exemplo n.º 1
0
 public CodeCompletionData(string displayText, string insertionText, int?recommendedCaretOffset = null, CompletionItemSelectionBehavior selectionBehavior = CompletionItemSelectionBehavior.Default, int priority = 0)
 {
     DisplayText              = displayText;
     InsertionText            = insertionText;
     RecommendedCaretPosition = recommendedCaretOffset;
     SelectionBehavior        = selectionBehavior;
     Priority = priority;
 }
Exemplo n.º 2
0
 private CompletionItemRules(
     ImmutableArray <CharacterSetModificationRule> filterCharacterRules,
     ImmutableArray <CharacterSetModificationRule> commitCharacterRules,
     EnterKeyRule enterKeyRule,
     bool formatOnCommit,
     int matchPriority,
     CompletionItemSelectionBehavior selectionBehavior)
 {
     FilterCharacterRules = filterCharacterRules.NullToEmpty();
     CommitCharacterRules = commitCharacterRules.NullToEmpty();
     EnterKeyRule         = enterKeyRule;
     FormatOnCommit       = formatOnCommit;
     MatchPriority        = matchPriority;
     SelectionBehavior    = selectionBehavior;
 }
Exemplo n.º 3
0
 private CompletionItemRules(
     ImmutableArray<CharacterSetModificationRule> filterCharacterRules,
     ImmutableArray<CharacterSetModificationRule> commitCharacterRules,
     EnterKeyRule enterKeyRule,
     bool formatOnCommit,
     int matchPriority,
     CompletionItemSelectionBehavior selectionBehavior)
 {
     FilterCharacterRules = filterCharacterRules.IsDefault ? ImmutableArray<CharacterSetModificationRule>.Empty : filterCharacterRules;
     CommitCharacterRules = commitCharacterRules.IsDefault ? ImmutableArray<CharacterSetModificationRule>.Empty : commitCharacterRules;
     EnterKeyRule = enterKeyRule;
     FormatOnCommit = formatOnCommit;
     MatchPriority = matchPriority;
     SelectionBehavior = selectionBehavior;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="CompletionItemRules"/> instance.
 /// </summary>
 /// <param name="filterCharacterRules">Rules about which keys typed are used to filter the list of completion items.</param>
 /// <param name="commitCharacterRules">Rules about which keys typed caused the completion item to be committed.</param>
 /// <param name="enterKeyRule">Rule about whether the enter key is passed through to the editor after the selected item has been committed.</param>
 /// <param name="formatOnCommit">True if the modified text should be formatted automatically.</param>
 /// <param name="matchPriority">True if the related completion item should be initially selected.</param>
 /// <param name="selectionBehavior">How this item should be selected if no text has been typed after the completion list is brought up.</param>
 /// <returns></returns>
 public static CompletionItemRules Create(
     ImmutableArray <CharacterSetModificationRule> filterCharacterRules = default(ImmutableArray <CharacterSetModificationRule>),
     ImmutableArray <CharacterSetModificationRule> commitCharacterRules = default(ImmutableArray <CharacterSetModificationRule>),
     EnterKeyRule enterKeyRule = EnterKeyRule.Default,
     bool formatOnCommit       = false,
     int?matchPriority         = null,
     CompletionItemSelectionBehavior selectionBehavior = CompletionItemSelectionBehavior.Default)
 {
     if (filterCharacterRules.IsDefaultOrEmpty &&
         commitCharacterRules.IsDefaultOrEmpty &&
         enterKeyRule == Default.EnterKeyRule &&
         formatOnCommit == Default.FormatOnCommit &&
         matchPriority.GetValueOrDefault() == Default.MatchPriority &&
         selectionBehavior == Default.SelectionBehavior)
     {
         return(Default);
     }
     else
     {
         return(new CompletionItemRules(
                    filterCharacterRules, commitCharacterRules, enterKeyRule, formatOnCommit,
                    matchPriority.GetValueOrDefault(), selectionBehavior));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a copy of this <see cref="CompletionItemRules"/> with the <see cref="SelectionBehavior"/> property changed.
 /// </summary>
 public CompletionItemRules WithSelectionBehavior(CompletionItemSelectionBehavior selectionBehavior)
 {
     return(this.With(selectionBehavior: selectionBehavior));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a copy of this <see cref="CompletionItemRules"/> with the <see cref="SelectionBehavior"/> property changed.
 /// </summary>
 public CompletionItemRules WithSelectionBehavior(CompletionItemSelectionBehavior selectionBehavior)
 {
     return this.With(selectionBehavior: selectionBehavior);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new <see cref="CompletionItemRules"/> instance.
 /// </summary>
 /// <param name="filterCharacterRules">Rules about which keys typed are used to filter the list of completion items.</param>
 /// <param name="commitCharacterRules">Rules about which keys typed caused the completion item to be committed.</param>
 /// <param name="enterKeyRule">Rule about whether the enter key is passed through to the editor after the selected item has been committed.</param>
 /// <param name="formatOnCommit">True if the modified text should be formatted automatically.</param>
 /// <param name="matchPriority">True if the related completion item should be initially selected.</param>
 /// <param name="selectionBehavior">How this item should be selected if no text has been typed after the completion list is brought up.</param>
 /// <returns></returns>
 public static CompletionItemRules Create(
     ImmutableArray<CharacterSetModificationRule> filterCharacterRules = default(ImmutableArray<CharacterSetModificationRule>),
     ImmutableArray<CharacterSetModificationRule> commitCharacterRules = default(ImmutableArray<CharacterSetModificationRule>),
     EnterKeyRule enterKeyRule = EnterKeyRule.Default,
     bool formatOnCommit = false,
     int? matchPriority = null,
     CompletionItemSelectionBehavior selectionBehavior = CompletionItemSelectionBehavior.Default)
 {
     if (filterCharacterRules.IsDefaultOrEmpty &&
         commitCharacterRules.IsDefaultOrEmpty &&
         enterKeyRule == Default.EnterKeyRule &&
         formatOnCommit == Default.FormatOnCommit &&
         matchPriority.GetValueOrDefault() == Default.MatchPriority &&
         selectionBehavior == Default.SelectionBehavior)
     {
         return Default;
     }
     else
     {
         return new CompletionItemRules(
             filterCharacterRules, commitCharacterRules, enterKeyRule, formatOnCommit,
             matchPriority.GetValueOrDefault(), selectionBehavior);
     }
 }