Skip to content

Commit

Permalink
SLLS-227 Remove temporary workaround endpoints for config scopes (#339)
Browse files Browse the repository at this point in the history
* SLLS-227 Remove temporary workaround endpoints for config scopes

* Adjust after rebase

* Fix (?) flakiness of test assertion

---------

Co-authored-by: Jean-Baptiste Lievremont <jeanbaptiste.lievremont@sonarsource.com>
  • Loading branch information
kirill-knize-sonarsource and jblievremont authored Mar 12, 2024
1 parent da52577 commit ed1e84c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -730,22 +730,4 @@ public boolean isBindingSuggestionDisabled() {
}
}

@JsonNotification("didAddConfigurationScopes")
CompletableFuture<Void> didAddConfigurationScopes(DidAddConfigurationScopes params);

class DidRemoveConfigurationScopeParams {
private final String removedId;

public DidRemoveConfigurationScopeParams(String removedId) {
this.removedId = removedId;
}

public String getRemovedId() {
return removedId;
}
}

@JsonNotification("didRemoveConfigurationScope")
CompletableFuture<Void> didRemoveConfigurationScope(DidRemoveConfigurationScopeParams params);

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.GetSupportedFilePatternsParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.GetSupportedFilePatternsResponse;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.binding.GetBindingSuggestionParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.BindingConfigurationDto;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.scope.ConfigurationScopeDto;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.auth.HelpGenerateUserTokenResponse;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.validate.ValidateConnectionParams;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.hotspot.CheckStatusChangePermittedParams;
Expand Down Expand Up @@ -917,23 +915,6 @@ public CompletableFuture<GetAllowedHotspotStatusesResponse> getAllowedHotspotSta
});
}

@Override
public CompletableFuture<Void> didAddConfigurationScopes(DidAddConfigurationScopes params) {
var bindingConfigurationDto = new BindingConfigurationDto(params.getConnectionId(), params.getSonarProjectKey(),
params.isBindingSuggestionDisabled());
var configurationDto = new ConfigurationScopeDto(params.getId(), null, params.isBindable(), params.getName(), bindingConfigurationDto);
var arg = new org.sonarsource.sonarlint.core.rpc.protocol.backend.config.scope.DidAddConfigurationScopesParams(List.of(configurationDto));
backendServiceFacade.getBackendService().didAddConfigurationScopes(arg);
return CompletableFuture.completedFuture(null);
}

@Override
public CompletableFuture<Void> didRemoveConfigurationScope(DidRemoveConfigurationScopeParams params) {
var arg = new org.sonarsource.sonarlint.core.rpc.protocol.backend.config.scope.DidRemoveConfigurationScopeParams(params.getRemovedId());
backendServiceFacade.getBackendService().didRemoveConfigurationScope(arg);
return CompletableFuture.completedFuture(null);
}

@Override
public void reopenResolvedLocalIssues(ReopenAllIssuesForFileParams params) {
var reopenAllIssuesParams = new org.sonarsource.sonarlint.core.rpc.protocol.backend.issue.ReopenAllIssuesForFileParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -96,7 +95,6 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.sonarsource.sonarlint.core.rpc.protocol.client.binding.AssistBindingParams;
import org.sonarsource.sonarlint.core.rpc.protocol.client.binding.SuggestBindingParams;
import org.sonarsource.sonarlint.core.rpc.protocol.client.hotspot.HotspotDetailsDto;
import org.sonarsource.sonarlint.ls.EnginesFactory;
import org.sonarsource.sonarlint.ls.ServerMain;
import org.sonarsource.sonarlint.ls.SonarLintExtendedLanguageClient;
Expand Down Expand Up @@ -276,11 +274,11 @@ final void closeFiles() {
for (var uri : notebooksToBeClosed) {
lsProxy.getNotebookDocumentService().didClose(new DidCloseNotebookDocumentParams(new NotebookDocumentIdentifier(uri), List.of()));
}
var changeWorkspaceFoldersParams = new DidChangeWorkspaceFoldersParams();
var event = new WorkspaceFoldersChangeEvent();
event.setRemoved(foldersToRemove.stream().map(WorkspaceFolder::new).collect(Collectors.toList()));
changeWorkspaceFoldersParams.setEvent(event);
lsProxy.getWorkspaceService().didChangeWorkspaceFolders(changeWorkspaceFoldersParams);
foldersToRemove.forEach(folderUri -> {
lsProxy.getWorkspaceService().didChangeWorkspaceFolders(new DidChangeWorkspaceFoldersParams(
new WorkspaceFoldersChangeEvent(List.of(), List.of(new WorkspaceFolder(folderUri)))));
awaitUntilAsserted(() -> assertLogContains("Configuration scope '" + folderUri + "' removed, clearing matched branch"));
});
instanceTempDirs.forEach(tempDirPath -> FileUtils.deleteQuietly(tempDirPath.toFile()));
instanceTempDirs.clear();
}
Expand Down
Loading

0 comments on commit ed1e84c

Please sign in to comment.