Skip to content

Commit b01dc55

Browse files
committed
Update completion model to support TypeScript 2.4 CodeAction. See
#22
1 parent 4ea906b commit b01dc55

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

core/ts.core/src/ts/client/completions/CompletionEntry.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ public class CompletionEntry implements IKindProvider {
5858
*/
5959
private TextSpan replacementSpan;
6060

61+
/**
62+
* Indicating if commiting this completion entry will require additional
63+
* code action to be made to avoid errors. The code action is normally
64+
* adding an additional import statement.
65+
*/
66+
private Boolean hasAction;
67+
6168
private Boolean isFunction;
6269

6370
private int relevance;
@@ -67,7 +74,7 @@ public class CompletionEntry implements IKindProvider {
6774
private final int offset;
6875

6976
private final transient ICompletionEntryMatcher matcher;
70-
77+
7178
private final transient ITypeScriptServiceClient client;
7279

7380
private List<CompletionEntryDetails> entryDetails;
@@ -167,4 +174,7 @@ public List<CompletionEntryDetails> getEntryDetails() throws TypeScriptException
167174
return this.entryDetails;
168175
}
169176

177+
public boolean hasActions() {
178+
return hasAction != null && hasAction;
179+
}
170180
}

core/ts.core/src/ts/client/completions/CompletionEntryDetails.java

+20
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
import java.util.List;
1414

15+
import ts.client.codefixes.CodeAction;
16+
1517
/**
1618
* Additional completion entry details, available on demand
1719
*/
@@ -39,6 +41,16 @@ public class CompletionEntryDetails {
3941
*/
4042
List<SymbolDisplayPart> documentation;
4143

44+
/**
45+
* JSDoc tags for the symbol.
46+
*/
47+
List<JSDocTagInfo> tags;
48+
49+
/**
50+
* The associated code actions for this entry
51+
*/
52+
List<CodeAction> codeActions;
53+
4254
public String getName() {
4355
return name;
4456
}
@@ -58,4 +70,12 @@ public List<SymbolDisplayPart> getDisplayParts() {
5870
public List<SymbolDisplayPart> getDocumentation() {
5971
return documentation;
6072
}
73+
74+
public List<JSDocTagInfo> getTags() {
75+
return tags;
76+
}
77+
78+
public List<CodeAction> getCodeActions() {
79+
return codeActions;
80+
}
6181
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package ts.client.completions;
2+
3+
public class JSDocTagInfo {
4+
5+
private String name;
6+
7+
private String text;
8+
9+
public String getName() {
10+
return name;
11+
}
12+
13+
public String getText() {
14+
return text;
15+
}
16+
}

0 commit comments

Comments
 (0)