microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bc7a32ce7b23591909f256ba627ef8e1fb8116a2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/rn-extension.ts

27lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import * as vscode from "vscode";
5
6import {PackageJsonWatcher} from "./utils/packageJsonWatcher";
7import {ReactNativeCommandHelper} from "./utils/reactNativeCommandHelper";
8
9export function activate(context: vscode.ExtensionContext): void {
10 // TODO: Get the project root (vscode.workspace.rootPath) and return if it is not a react-native project
11 // check if package.json of user project has dependency on react-native
12
13 let packageJsonWatcher = new PackageJsonWatcher();
14 packageJsonWatcher.startWatching();
15
16 // TODO: Change to a foreach if this implementation is appropriate
17 // Register react native commands
18 context.subscriptions.push(vscode.commands.registerCommand("reactNative.runAndroid",
19 () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "runAndroid")));
20 context.subscriptions.push(vscode.commands.registerCommand("reactNative.runIos",
21 () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "runIos")));
22 context.subscriptions.push(vscode.commands.registerCommand("reactNative.startPackager",
23 () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "startPackager")));
24 context.subscriptions.push(vscode.commands.registerCommand("reactNative.stopPackager",
25 () => ReactNativeCommandHelper.executeReactNativeCommand(vscode.workspace.rootPath, "stopPackager")));
26
27}