Skip to content

Commit

Permalink
Merge pull request #185 from codota/upgrade-api-version
Browse files Browse the repository at this point in the history
upgrade api version to 3.5.34
  • Loading branch information
yonip23 authored Aug 4, 2021
2 parents 802c2f2 + d068136 commit 43644d0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tabnine.binary.requests.autocomplete;

import com.tabnine.general.CompletionKind;
import com.tabnine.general.CompletionOrigin;

public class ResultEntry {
Expand All @@ -10,5 +11,6 @@ public class ResultEntry {
public CompletionOrigin origin;
public String detail;
public Boolean deprecated;
public CompletionKind completion_kind;
// TODO other lsp types
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tabnine.binary.requests.selection;

import com.google.gson.annotations.SerializedName;
import com.tabnine.general.CompletionKind;
import com.tabnine.general.CompletionOrigin;

import java.util.List;
Expand Down Expand Up @@ -38,4 +39,6 @@ public class SelectionRequest {
@SerializedName(value = "num_of_lsp_suggestions")
public Integer lspSuggestionsCount;
public List<SelectionSuggestionRequest> suggestions;
@SerializedName(value = "completion_kind")
public CompletionKind completionKind;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static java.util.Collections.singletonMap;

public class SetStateBinaryRequest implements BinaryRequest<SetStateBinaryResponse> {
private SelectionRequest selectionRequest;
private final SelectionRequest selectionRequest;

public SetStateBinaryRequest(SelectionRequest selectionRequest) {
this.selectionRequest = selectionRequest;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/tabnine/general/CompletionKind.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.tabnine.general;

public enum CompletionKind {
Classic,
Line
}
2 changes: 1 addition & 1 deletion src/main/java/com/tabnine/general/StaticConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class StaticConfig {
public static final String TABNINE_PLUGIN_ID_RAW = "com.tabnine.TabNine";
public static final PluginId TABNINE_PLUGIN_ID = PluginId.getId(TABNINE_PLUGIN_ID_RAW);
public static final int MAX_COMPLETIONS = 5;
public static final String BINARY_PROTOCOL_VERSION = "3.2.71";
public static final String BINARY_PROTOCOL_VERSION = "3.5.34";
public static final int COMPLETION_TIME_THRESHOLD = 1000;
public static final int ILLEGAL_RESPONSE_THRESHOLD = 5;
public static final int CONSECUTIVE_RESTART_THRESHOLD = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ private LookupElement createCompletion(CompletionParameters parameters, Completi
resultSet.getPrefixMatcher().getPrefix(),
getCursorPrefix(parameters),
getCursorSuffix(parameters),
result.origin
result.origin,
result.completion_kind
);

completion.detail = result.detail;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/tabnine/prediction/TabNineCompletion.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tabnine.prediction;

import com.tabnine.general.CompletionKind;
import com.tabnine.general.CompletionOrigin;

public class TabNineCompletion {
Expand All @@ -12,11 +13,12 @@ public class TabNineCompletion {
public String cursorPrefix;
public String cursorSuffix;
public CompletionOrigin origin;
public CompletionKind completionKind;

public String detail = null;
public boolean deprecated = false;

public TabNineCompletion(String oldPrefix, String newPrefix, String oldSuffix, String newSuffix, int index, String completionPrefix, String cursorPrefix, String cursorSuffix, CompletionOrigin origin) {
public TabNineCompletion(String oldPrefix, String newPrefix, String oldSuffix, String newSuffix, int index, String completionPrefix, String cursorPrefix, String cursorSuffix, CompletionOrigin origin, CompletionKind completionKind) {
this.oldPrefix = oldPrefix;
this.newPrefix = newPrefix;
this.oldSuffix = oldSuffix;
Expand All @@ -26,6 +28,7 @@ public TabNineCompletion(String oldPrefix, String newPrefix, String oldSuffix, S
this.cursorPrefix = cursorPrefix;
this.cursorSuffix = cursorSuffix;
this.origin = origin;
this.completionKind = completionKind;
}

public CompletionOrigin getOrigin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void itemSelected(@NotNull LookupEvent event) {
selection.origin = item.origin;
selection.length = item.newPrefix.length();
selection.strength = getStrength(item);
selection.completionKind = item.completionKind;
addSuggestionsCount(selection, suggestions);

binaryRequestFacade.executeRequest(new SetStateBinaryRequest(selection));
Expand Down

0 comments on commit 43644d0

Please sign in to comment.