Skip to content

Commit 6df64f1

Browse files
committed
Fix UnsupportedOperationException when creating 'scratch file' in IntelliJ IDEA
Signed-off-by: Dmytro Nosan <[email protected]>
1 parent e0f7699 commit 6df64f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/src/main/java/io/spring/format/formatter/intellij/formatting/SpringJavaFormatFormattingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public boolean canFormat(@NotNull PsiFile file) {
7878
public void formatDocument(@NotNull Document document, @NotNull List<TextRange> formattingRanges,
7979
@NotNull FormattingContext formattingContext, boolean canChangeWhiteSpaceOnly, boolean quickFormat) {
8080
VirtualFile file = formattingContext.getVirtualFile();
81-
Path path = (file != null) ? file.toNioPath() : null;
81+
Path path = (file != null) ? file.getFileSystem().getNioPath(file) : null;
8282
JavaFormatConfig config = JavaFormatConfig.findFrom(path);
8383
Formatter formatter = new Formatter(config);
8484
String source = document.getText();

0 commit comments

Comments
 (0)