Created openInIDE API inside Layout Plugin

Summary: Created a communication between Layout Plugin and Flipper Desktop. The API allows users to open given file in a selected IDE. The openInIDE function returns true if the connection with Flipper is established, otherwise returns false.

Reviewed By: adityasharat

Differential Revision: D22625829

fbshipit-source-id: feaf186c107d62b1a75dfc6bbe2c1d66ffd7fd78
This commit is contained in:
Dominik Wielgórski
2020-07-21 09:26:30 -07:00
committed by Facebook GitHub Bot
parent 3e4d92aad0
commit cf6df492ee
2 changed files with 55 additions and 0 deletions

View File

@@ -37,6 +37,12 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
private @Nullable List<ExtensionCommand> mExtensionCommands;
private boolean mShowLithoAccessibilitySettings;
public enum IDE {
diffusion,
AS,
VSCode
}
/** An interface for extensions to the Inspector Flipper plugin */
public interface ExtensionCommand {
/** The command to respond to */
@@ -419,6 +425,23 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
}
};
public boolean openInIDE(
String fileName, String className, String dirRoot, String repo, int lineNumber, IDE ide) {
if (mConnection == null) return false;
mConnection.send(
"openInIDE",
new FlipperObject.Builder()
.put("fileName", fileName)
.put("className", className)
.put("dirRoot", dirRoot)
.put("repo", repo)
.put("lineNumber", lineNumber)
.put("ide", ide)
.build());
return true;
}
private void setHighlighted(
final String id, final boolean highlighted, final boolean isAlignmentMode) throws Exception {
final Object obj = mObjectTracker.get(id);