forked from OmniSharp/omnisharp-roslyn
/
CompletionItem.cs
143 lines (124 loc) · 4.56 KB
/
CompletionItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#nullable enable
using System;
using System.Collections.Generic;
namespace OmniSharp.Models.v1.Completion
{
public class CompletionItem
{
/// <summary>
/// The label of this completion item. By default
/// also the text that is inserted when selecting
/// this completion.
/// </summary>
public string Label { get; set; } = null!;
/// <summary>
/// The kind of this completion item. Based of the kind
/// an icon is chosen by the editor.The standardized set
/// of available values is defined in <see cref="CompletionItemKind"/>
/// </summary>
public CompletionItemKind Kind { get; set; }
/// <summary>
/// Tags for this completion item
/// </summary>
public IReadOnlyList<CompletionItemTag>? Tags { get; set; }
/// <summary>
/// A human-readable string with additional information
/// about this item, like type or symbol information
/// </summary>
public string? Detail { get; set; }
/// <summary>
/// A human-readable string that represents a doc-comment. This is
/// formatted as markdown.
/// </summary>
public string? Documentation { get; set; }
/// <summary>
/// Select this item when showing.
/// </summary>
public bool Preselect { get; set; }
/// <summary>
/// A string that should be used when comparing this item
/// with other items. When null or empty the label is used.
/// </summary>
public string? SortText { get; set; }
/// <summary>
/// A string that should be used when filtering a set of
/// completion items. When null or empty the label is used.
/// </summary>
public string? FilterText { get; set; }
/// <summary>
/// The format of <see cref="InsertText"/>. This applies to both <see cref="InsertText"/> and
/// <see cref="TextEdit"/>.<see cref="LinePositionSpanTextChange.NewText"/>.
/// </summary>
public InsertTextFormat InsertTextFormat { get; set; }
/// <summary>
/// An edit which is applied to a document when selecting this completion. When an edit is provided the value of
/// <see cref="InsertText"/> is ignored.
/// </summary>
public LinePositionSpanTextChange? TextEdit { get; set; }
/// <summary>
/// An optional set of characters that when pressed while this completion is active will accept it first and
/// then type that character.
/// </summary>
public IReadOnlyList<char>? CommitCharacters { get; set; }
/// <summary>
/// An optional array of additional text edits that are applied when
/// selecting this completion.Edits must not overlap (including the same insert position)
/// with the main edit nor with themselves.
///
/// Additional text edits should be used to change text unrelated to the current cursor position
/// (for example adding an import statement at the top of the file if the completion item will
/// insert an unqualified type).
/// </summary>
public IReadOnlyList<LinePositionSpanTextChange>? AdditionalTextEdits { get; set; }
/// <summary>
/// Index in the completions list that this completion occurred.
/// </summary>
public (long CacheId, int Index) Data { get; set; }
/// <summary>
/// True if there is a post-insert step for this completion item for asynchronous completion support.
/// </summary>
public bool HasAfterInsertStep { get; set; }
public override string ToString()
{
return $"{{ {nameof(Label)} = {Label}, {nameof(CompletionItemKind)} = {Kind} }}";
}
}
public enum CompletionItemKind
{
Text = 1,
Method = 2,
Function = 3,
Constructor = 4,
Field = 5,
Variable = 6,
Class = 7,
Interface = 8,
Module = 9,
Property = 10,
Unit = 11,
Value = 12,
Enum = 13,
Keyword = 14,
Snippet = 15,
Color = 16,
File = 17,
Reference = 18,
Folder = 19,
EnumMember = 20,
Constant = 21,
Struct = 22,
Event = 23,
Operator = 24,
TypeParameter = 25,
}
public enum CompletionItemTag
{
Deprecated = 1,
}
public enum InsertTextFormat
{
PlainText = 1,
// TODO: Support snippets
Snippet = 2,
}
}