R Code Analyzer (vscode-flowr)This extension brings flowR to Visual Studio Code. With it, you gain access to the following features (this extension is under active development, so many more features are planned):
UseThis section provides a brief overview of the features provided by this extension and how to use them. See below for instructions on how to install the extension. PrerequisitesInstalling the extension is sufficient for all features!
Yet, flowR may benefit from a local R installation (which has to be available on your Additionally, we recommend using the R extension for Visual Studio Code along with this extension. For more information on R development in Visual Studio Code, you can also check out this helpful article. SlicingSlicing describes the process of reducing a program to just the parts relevant to a specific variable or figure. With the extension loaded, select a variable you are interested in and either press Ctrl+S to slice for it once or Ctrl+P to mark the position and continuously update the slice as you edit the file. The editor will gray out all code that is not part of the generated slice. Detailed ExplanationYou can generate a slice of the currently highlighted variable in any R code by using the "Slice for Cursor Position" command. All code that is not part of the generated slice will then be grayed out. Optionally, you can also use one of the two "Toggle Continuous Slice" options, which will automatically cause the slice to be updated when code changes occur or when the cursor is moved. You can also view the reconstruction of a piece of code based on the current slice. The "Show Current Slice in Editor (Reconstruct)" command opens a view next to the current editor that will automatically update the reconstruction as you slice. To clear the slice highlighting, use the "Clear Current Slice Presentation" command. Dependency ViewUsing the extension, the sidebar should contain a flowR icon which holds more information on the current file, listing the libraries loaded, the files read and written, and the sourced scripts. If you expand the respective sections, clicking on the found entries should open them in the editor. The context menu (available with a right click) allows you to slice for the selected entry. DataflowYou can generate and view the dataflow graph for any R source file by using the "Show Dataflow Graph" command while the file is open in the active editor. The dataflow graph will then be displayed in an interactive tab on the side, where you can pan and zoom to inspect it. In the future, we plan on including the ability to select nodes in the dataflow graph and have relevant code sections highlighted, and vice versa. REPLflowR offers a REPL, a "read-eval-print loop", which allows you to interactively explore the features of flowR. You can open a new REPL either with the "Launch a new flowR REPL" command (in the command palette which you can open with Ctrl+Shift+P) or by clicking on the shell icon of the flowR sidebar: This opens a new terminal in which you can interact with the (local) flowR installation: InstallingFrom Visual Studio MarketplaceYou can get the extension here: https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr. From GitHub ReleaseYou can find official releases of the extension in the Releases section of the repository. Simply select the version you would like to download, open up the asset's section at the bottom, and download the From Visual Studio Code, open the Extensions tab and click on the three dots in the top right to select "Install from VSIX..." Alternatively, you can use the Command Palette to select the option directly. Then, you can select the From Build ArtifactYou can easily download the most recent build of the extension by heading to the Actions tab, where you will find a list of runs. Selecting the most recent run will display a summary of it, at the bottom of which you can find the Artifacts section and the Then, you can install it the same way as you would the DevelopmentBuilding and Running from SourceAfter cloning the repository, required dependencies can be installed using npm:
Note that this does not install R, which is also not strictly required for development, but (obviously) highly encouraged. Opening the cloned repository in Visual Studio Code allows using the existing launch configurations which can launch Visual Studio Code with the extension enabled. To use them, open the Run and Debug view and press the Run button at the top, or use the F5 shortcut to start debugging. You can then open the example folder contained in this repository to try out the extension for yourself. To build the extension into a Git HooksThis repository contains some git hooks to ensure that linting and other actions happen. Register these hooks by running:
|