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

Stops optimizing imports via palantir-java-formatter #1089

Merged
merged 5 commits into from
May 21, 2024
Merged
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
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
@@ -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;
@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return an empty set (or not override if it's set up like that) getImportOptimizers?

}

@Override
@@ -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;

This file was deleted.

This file was deleted.

Loading