forked from flutter/flutter-intellij
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter out json formatting (flutter#183)
- Loading branch information
1 parent
d7d73f5
commit 725f725
Showing
6 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/io/flutter/run/daemon/DaemonJsonInputFilterProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2016 The Chromium Authors. All rights reserved. | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
package io.flutter.run.daemon; | ||
|
||
import com.intellij.execution.filters.ConsoleInputFilterProvider; | ||
import com.intellij.execution.filters.InputFilter; | ||
import com.intellij.execution.ui.ConsoleViewContentType; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.util.Pair; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class DaemonJsonInputFilterProvider implements ConsoleInputFilterProvider { | ||
|
||
@NotNull | ||
@Override | ||
public InputFilter[] getDefaultFilters(@NotNull Project project) { | ||
return new InputFilter[]{new DaemonJsonInputFilter()}; | ||
} | ||
|
||
private static class DaemonJsonInputFilter implements InputFilter { | ||
@Nullable | ||
@Override | ||
public List<Pair<String, ConsoleViewContentType>> applyFilter(String text, ConsoleViewContentType contentType) { | ||
if (text.startsWith("[{") && text.endsWith("}]\n")) { | ||
return Collections.singletonList(Pair.create(null, contentType)); | ||
} | ||
return Collections.singletonList(Pair.create(text, contentType)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters