Skip to content

Commit

Permalink
Stops optimizing imports via palantir-java-formatter (#1089)
Browse files Browse the repository at this point in the history
Stops optimizing imports via palantir-java-formatter
  • Loading branch information
crogoz authored May 21, 2024
1 parent 9e6d8be commit 2fdb2c5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 287 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1089.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Stops optimizing imports via palantir-java-formatter
links:
- https://github.com/palantir/palantir-java-format/pull/1089
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.intellij.formatting.service.AsyncDocumentFormattingService;
import com.intellij.formatting.service.AsyncFormattingRequest;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.ImportOptimizer;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.TextRange;
Expand Down Expand Up @@ -61,7 +60,7 @@ protected FormattingTask createFormattingTask(@NotNull AsyncFormattingRequest re

@Override
public @NotNull Set<Feature> getFeatures() {
return Set.of(Feature.FORMAT_FRAGMENTS, Feature.OPTIMIZE_IMPORTS);
return Set.of(Feature.FORMAT_FRAGMENTS);
}

@Override
Expand All @@ -70,14 +69,6 @@ public boolean canFormat(@NotNull PsiFile file) {
&& PalantirJavaFormatSettings.getInstance(file.getProject()).isEnabled();
}

@Override
public @NotNull Set<ImportOptimizer> getImportOptimizers(@NotNull PsiFile file) {
Project project = file.getProject();
PalantirJavaFormatSettings settings = PalantirJavaFormatSettings.getInstance(project);
Optional<FormatterService> formatter = formatterProvider.get(project, settings);
return Set.of(new PalantirJavaFormatImportOptimizer(formatter));
}

private static final class PalantirJavaFormatFormattingTask implements FormattingTask {
private final AsyncFormattingRequest request;
private final Optional<FormatterService> formatterService;
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 2fdb2c5

Please sign in to comment.