diff --git a/src/main/java/com/tabnine/binary/BinaryRun.java b/src/main/java/com/tabnine/binary/BinaryRun.java index 7a370910f..7ad07a8b3 100644 --- a/src/main/java/com/tabnine/binary/BinaryRun.java +++ b/src/main/java/com/tabnine/binary/BinaryRun.java @@ -16,98 +16,106 @@ import com.tabnine.binary.fetch.BinaryVersionFetcher; import com.tabnine.config.Config; import com.tabnine.general.StaticConfig; + import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class BinaryRun { - private final BinaryVersionFetcher binaryFetcher; + private final BinaryVersionFetcher binaryFetcher; - public BinaryRun(BinaryVersionFetcher binaryFetcher) { - this.binaryFetcher = binaryFetcher; - } + public BinaryRun(BinaryVersionFetcher binaryFetcher) { + this.binaryFetcher = binaryFetcher; + } - @NotNull - public List generateRunCommand(@Nullable Map additionalMetadata) - throws NoValidBinaryToRunException { - List command = new ArrayList<>(singletonList(binaryFetcher.fetchBinary())); + @NotNull + public List generateRunCommand(@Nullable Map additionalMetadata) + throws NoValidBinaryToRunException { + List command = new ArrayList<>(singletonList(binaryFetcher.fetchBinary())); - command.addAll(getBinaryConstantParameters(additionalMetadata)); + command.addAll(getBinaryConstantParameters(additionalMetadata)); - return command; - } + return command; + } - public Process reportUninstall(@Nullable Map additionalMetadata) - throws NoValidBinaryToRunException, TabNineDeadException { - String fullLocation = binaryFetcher.fetchBinary(); - List command = new ArrayList<>(asList(fullLocation, UNINSTALLING_FLAG)); + public Process reportUninstall(@Nullable Map additionalMetadata) + throws NoValidBinaryToRunException, TabNineDeadException { + String fullLocation = binaryFetcher.fetchBinary(); + List command = new ArrayList<>(asList(fullLocation, UNINSTALLING_FLAG)); - command.addAll(getBinaryConstantParameters(additionalMetadata)); + command.addAll(getBinaryConstantParameters(additionalMetadata)); - try { - return new ProcessBuilder(command).start(); - } catch (IOException e) { - throw new TabNineDeadException(e, fullLocation); - } - } - - private ArrayList getBinaryConstantParameters( - @Nullable Map additionalMetadata) { - ArrayList constantParameters = new ArrayList<>(); - if (ApplicationManager.getApplication() != null - && !ApplicationManager.getApplication().isUnitTestMode()) { - List metadata = - new ArrayList<>( - asList( - "--client-metadata", - "pluginVersion=" + cmdSanitize(getTabNinePluginVersion()), - "clientIsUltimate=" + PlatformUtils.isIdeaUltimate(), - "clientChannel=" + Config.CHANNEL, - "pluginUserId=" + PermanentInstallationID.get(), - "debounceValue=" + getDebounceInterval())); - final ApplicationInfo applicationInfo = ApplicationInfo.getInstance(); - - if (applicationInfo != null) { - constantParameters.add("--client"); - constantParameters.add(cmdSanitize(applicationInfo.getVersionName())); - constantParameters.add("--no-lsp"); - constantParameters.add("true"); - - metadata.add("clientVersion=" + cmdSanitize(applicationInfo.getFullVersion())); - metadata.add("clientApiVersion=" + cmdSanitize(applicationInfo.getApiVersion())); - } - - if (Config.IS_ON_PREM && StaticConfig.getTabnineEnterpriseHost().isPresent()) { - constantParameters.add( - "--cloud2_url=" + cmdSanitize(StaticConfig.getTabnineEnterpriseHost().get())); - } - - if (additionalMetadata != null) { - additionalMetadata.forEach( - (key, value) -> - metadata.add(String.format("%s=%s", key, cmdSanitize(value.toString())))); - } - - getLogFilePath() - .ifPresent( - v -> { - constantParameters.add("--log-file-path"); - constantParameters.add(v); - }); - - getLogLevel() - .ifPresent( - v -> { - constantParameters.add("--log-level"); - constantParameters.add(v); - }); - - constantParameters.addAll(metadata); + try { + return new ProcessBuilder(command).start(); + } catch (IOException e) { + throw new TabNineDeadException(e, fullLocation); + } } - return constantParameters; - } + private ArrayList getBinaryConstantParameters( + @Nullable Map additionalMetadata) { + ArrayList constantParameters = new ArrayList<>(); + if (ApplicationManager.getApplication() != null + && !ApplicationManager.getApplication().isUnitTestMode()) { + List metadata = + new ArrayList<>( + asList( + "--client-metadata", + "pluginVersion=" + cmdSanitize(getTabNinePluginVersion()), + "clientIsUltimate=" + PlatformUtils.isIdeaUltimate(), + "clientChannel=" + Config.CHANNEL, + "pluginUserId=" + PermanentInstallationID.get(), + "debounceValue=" + getDebounceInterval())); + final ApplicationInfo applicationInfo = ApplicationInfo.getInstance(); + + if (applicationInfo != null) { + constantParameters.add("--client"); + constantParameters.add(cmdSanitize(applicationInfo.getVersionName())); + constantParameters.add("--no-lsp"); + constantParameters.add("true"); + + metadata.add("clientVersion=" + cmdSanitize(applicationInfo.getFullVersion())); + metadata.add("clientApiVersion=" + cmdSanitize(applicationInfo.getApiVersion())); + } + + if (Config.IS_ON_PREM) { + + if (StaticConfig.getTabnineEnterpriseHost().isPresent()) { + constantParameters.add( + "--cloud2_url=" + cmdSanitize(StaticConfig.getTabnineEnterpriseHost().get())); + } else { + constantParameters.add( + "--cloud2_url=" + cmdSanitize("https://tabnine.sec.samsung.net")); + } + } + + if (additionalMetadata != null) { + additionalMetadata.forEach( + (key, value) -> + metadata.add(String.format("%s=%s", key, cmdSanitize(value.toString())))); + } + + getLogFilePath() + .ifPresent( + v -> { + constantParameters.add("--log-file-path"); + constantParameters.add(v); + }); + + getLogLevel() + .ifPresent( + v -> { + constantParameters.add("--log-level"); + constantParameters.add(v); + }); + + constantParameters.addAll(metadata); + } + + return constantParameters; + } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 8403797b5..43859d525 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,6 +1,6 @@ - Tabnine AI Code Completion- JS Java Python TS Rust Go PHP & More + Tabnine AI Code Completion - JS Java Python TS Rust Go PHP & More com.tabnine.TabNine Tabnine More resources: Tabnine blog, Tabnine Academy Questions? Check out our FAQ, Learn more about our premium plans.

-]]> -
+]]> + Tabnine is always evolving. Most updates are in the binary sidecar. @@ -115,7 +115,9 @@ - + @@ -123,22 +125,29 @@ - + - - - + + + - + - + - +