Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent from telemetry crash when language servers starts #1210

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import com.redhat.devtools.intellij.lsp4mp4ij.settings.MicroProfileInspectionsInfo;
import com.redhat.devtools.intellij.quarkus.TelemetryService;
import com.redhat.devtools.intellij.lsp4ij.server.JavaProcessCommandBuilder;
import com.redhat.devtools.intellij.lsp4ij.server.ProcessStreamConnectionProvider;
import com.redhat.devtools.intellij.lsp4mp4ij.settings.UserDefinedMicroProfileSettings;
import com.redhat.devtools.intellij.quarkus.TelemetryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.net.URI;
Expand All @@ -32,6 +33,8 @@
*/
public class QuarkusServer extends ProcessStreamConnectionProvider {

private static final Logger LOGGER = LoggerFactory.getLogger(QuarkusServer.class);

private final Project project;

public QuarkusServer(Project project) {
Expand All @@ -40,14 +43,18 @@ public QuarkusServer(Project project) {
File lsp4mpServerPath = new File(descriptor.getPath(), "lib/server/org.eclipse.lsp4mp.ls-uber.jar");
File quarkusServerPath = new File(descriptor.getPath(), "lib/server/com.redhat.quarkus.ls.jar");

List<String> commands = new JavaProcessCommandBuilder(project,"quarkus")
List<String> commands = new JavaProcessCommandBuilder(project, "quarkus")
.setJar(lsp4mpServerPath.getAbsolutePath())
.setCp(quarkusServerPath.getAbsolutePath())
.create();
commands.add("-DrunAsync=true");
super.setCommands(commands);

TelemetryService.instance().action(TelemetryService.LSP_PREFIX + "start").send();
try {
TelemetryService.instance().action(TelemetryService.LSP_PREFIX + "start").send();
} catch (Exception e) {
LOGGER.error("Error while consuming telemetry service", e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import com.redhat.devtools.intellij.lsp4mp4ij.settings.UserDefinedMicroProfileSettings;
import com.redhat.devtools.intellij.quarkus.TelemetryService;
import com.redhat.devtools.intellij.lsp4ij.server.JavaProcessCommandBuilder;
import com.redhat.devtools.intellij.lsp4ij.server.ProcessStreamConnectionProvider;
import com.redhat.devtools.intellij.qute.settings.QuteInspectionsInfo;
import com.redhat.devtools.intellij.quarkus.TelemetryService;
import com.redhat.devtools.intellij.qute.settings.UserDefinedQuteSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.net.URI;
Expand All @@ -33,6 +33,8 @@
*/
public class QuteServer extends ProcessStreamConnectionProvider {

private static final Logger LOGGER = LoggerFactory.getLogger(QuteServer.class);

private final Project project;

public QuteServer(Project project) {
Expand All @@ -46,7 +48,12 @@ public QuteServer(Project project) {
commands.add("-DrunAsync=true");
super.setCommands(commands);

TelemetryService.instance().action(TelemetryService.LSP_PREFIX + "startQute").send();
try {
TelemetryService.instance().action(TelemetryService.LSP_PREFIX + "startQute").send();
}
catch(Exception e) {
LOGGER.error("Error while consuming telemetry service", e);
}
}

@Override
Expand Down
Loading