use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration.Builder in project sonarlint-core by SonarSource.
the class StandaloneSonarLintImpl method start.
private void start() {
Builder builder = StandaloneGlobalConfiguration.builder();
for (URL pluginPath : analyzers) {
builder.addPlugin(pluginPath);
}
builder.setLogOutput(logOutput);
builder.setSonarLintUserHome(Utils.getStandaloneHome());
engine = new StandaloneSonarLintEngineImpl(builder.build());
}
use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration.Builder in project sonarlint-core by SonarSource.
the class SonarLintLanguageServer method initialize.
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
String rootUri = params.getRootUri();
// rootURI is null when no folder is open (like opening a single file in VSCode)
if (rootUri != null) {
try {
workspaceRoot = new URI(rootUri);
} catch (URISyntaxException e) {
throw new IllegalStateException(e);
}
}
Map<String, Object> options = (Map<String, Object>) params.getInitializationOptions();
userSettings = new UserSettings(options);
String productKey = (String) options.get("productKey");
// deprecated, will be ignored when productKey present
String telemetryStorage = (String) options.get("telemetryStorage");
String productName = (String) options.get("productName");
String productVersion = (String) options.get("productVersion");
telemetry.init(getStoragePath(productKey, telemetryStorage), productName, productVersion);
telemetry.optOut(userSettings.disableTelemetry);
info("Starting SonarLint engine...");
info("Using " + analyzers.size() + " analyzers");
try {
Map<String, String> extraProperties = new HashMap<>();
extraProperties.put("sonar.typescript.internal.typescriptLocation", (String) options.get(TYPESCRIPT_LOCATION));
Builder builder = StandaloneGlobalConfiguration.builder().setLogOutput(logOutput).setExtraProperties(extraProperties).addPlugins(analyzers.toArray(new URL[0]));
this.engine = new StandaloneSonarLintEngineImpl(builder.build());
} catch (Exception e) {
error("Error starting SonarLint engine", e);
throw new IllegalStateException(e);
}
info("SonarLint engine started");
InitializeResult result = new InitializeResult();
ServerCapabilities c = new ServerCapabilities();
TextDocumentSyncOptions textDocumentSyncOptions = new TextDocumentSyncOptions();
textDocumentSyncOptions.setOpenClose(true);
textDocumentSyncOptions.setChange(TextDocumentSyncKind.Full);
textDocumentSyncOptions.setSave(new SaveOptions(true));
c.setTextDocumentSync(textDocumentSyncOptions);
c.setCodeActionProvider(true);
c.setExecuteCommandProvider(new ExecuteCommandOptions(asList(SONARLINT_OPEN_RULE_DESCRIPTION_COMMAND)));
result.setCapabilities(c);
return CompletableFuture.completedFuture(result);
}
Aggregations