Difference between revisions of "VS Code Tips"
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | < | + | =Introduction= |
+ | Visual Studio Code (commonly referred to as VS Code) is a free source code editor developed by Microsoft. It can be downloaded <u>[https://code.visualstudio.com/Download here]</u>. It supports a variety of file types and can be used to work with TUFLOW control files. | ||
+ | Thousands of free plugins exist for VS Code and some of them are useful when working with TUFLOW models.<br> | ||
+ | <br> | ||
+ | |||
+ | =TUFLOW VS Code Plugin= | ||
+ | The TUFLOW plugin provides syntax highlighting support. <b>Thanks to Daniel Copelin for creating the TUFLOW plugin.</b> One feature of VS Code is that it includes an explorer window from a root folder, so it is easy to navigate the files within a project.<br> | ||
+ | ==Install TUFLOW Plugin== | ||
+ | The <u>[https://marketplace.visualstudio.com/items?itemName=danielcopelin.tuflow TUFLOW Plugin]</u> can be installed like any other VS Code plugins. In the VS Code application: | ||
+ | <ol> | ||
+ | <li>Select 'Extensions' from the toolbar on the right-hand side. | ||
+ | <li>Search for 'TUFLOW'. | ||
+ | <li>Select install. | ||
+ | <br><br> | ||
+ | {{Video|name=Animation_install_TUFLOW.mp4|width=900}}<br> | ||
+ | </ol> | ||
− | == | + | ==File Navigation== |
− | + | In VS Code, it is possible to create and edit TUFLOW models and their control files. <br> | |
− | + | *Select File > Open Folder and navigate to the model folder. This will open the model folder into the 'Explorer' panel. | |
+ | *Now, from the Explorer panel, it is possible to navigate through the model folders and edit control files. | ||
+ | *Using the <u>[https://marketplace.visualstudio.com/items?itemName=Fr43nk.seito-openfile Open File]</u> plugin, it is possible to easily navigate between files. | ||
+ | <br> | ||
+ | {{Video|name=Animation_file_navigation.mp4|width=900}} | ||
<br> | <br> | ||
+ | </ol> | ||
− | == | + | ==Running TUFLOW== |
+ | To run TUFLOW through VS Code, the <u>[https://marketplace.visualstudio.com/items?itemName=NilsSoderman.batch-runner Batch Runner]</u> extension is required. Once installed, TUFLOW can be run by either: | ||
+ | *Right clicking the batch file in the explorer panel and selecting 'Run Batch File', or | ||
+ | <br> | ||
+ | {{Video|name=Animation_run_right_click.mp4|width=900}} | ||
+ | <br> | ||
+ | *Open the batch file into the editor, and press the 'Run' button. | ||
+ | <br> | ||
+ | {{Video|name=Animation_run_button.mp4|width=900}} | ||
+ | <br> | ||
+ | This will open a terminal and the TUFLOW simulation will run. | ||
− | = | + | =Other Useful Plugins= |
In addition to the TUFLOW plugin, some useful plugins for working with TUFLOW include: <br> | In addition to the TUFLOW plugin, some useful plugins for working with TUFLOW include: <br> | ||
− | *[https://marketplace.visualstudio.com/items?itemName=Fr43nk.seito-openfile | + | ===Open File=== |
+ | :*Open File by Frank Stuetzer or similar is a free plugin available for download <u>[https://marketplace.visualstudio.com/items?itemName=Fr43nk.seito-openfile here]</u>. | ||
:*Right-click on a filename and select 'Open file under cursor'. If the file is found by VS Code, then the selected file will open in a new tab. | :*Right-click on a filename and select 'Open file under cursor'. If the file is found by VS Code, then the selected file will open in a new tab. | ||
:*To open multiple files, hold down Alt while selecting the filenames, then right click and select 'Open file under cursor'. If the files are found by VS Code, then the selected files will each open in a new tab. | :*To open multiple files, hold down Alt while selecting the filenames, then right click and select 'Open file under cursor'. If the files are found by VS Code, then the selected files will each open in a new tab. | ||
<br>{{Video|name=Animation_OpenFile.mp4|width=900}} | <br>{{Video|name=Animation_OpenFile.mp4|width=900}} | ||
<br> | <br> | ||
− | *[https://marketplace.visualstudio.com/items?itemName=ionutvmi.path-autocomplete | + | |
+ | ===Path Autocomplete=== | ||
+ | :*Path Autocomplete by Mihai Vilcu is a free plugin available for download <u>[https://marketplace.visualstudio.com/items?itemName=ionutvmi.path-autocomplete here]</u>. | ||
:*Adds auto-complete when it determines a filename is being written. For this feature to work, set the 'triggerOutsideStrings' to true (as described in the plugin details). <br> | :*Adds auto-complete when it determines a filename is being written. For this feature to work, set the 'triggerOutsideStrings' to true (as described in the plugin details). <br> | ||
<ol> | <ol> | ||
Line 21: | Line 54: | ||
:<li>Toggle on the 'Trigger Outside Strings' in the settings on the right. | :<li>Toggle on the 'Trigger Outside Strings' in the settings on the right. | ||
</ol> | </ol> | ||
− | *[https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.geo-data-viewer | + | :*An example of its functionality is shown below. |
+ | <br>{{Video|name=Animation_path_autocomplete.mp4|width=900}} | ||
+ | <br> | ||
+ | |||
+ | ===Geo Data Viewer=== | ||
+ | :*Geo Data Viewer by Random Fractals inc is a free plugin available for download <u>[https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.geo-data-viewer here]</u>. | ||
:*Has the ability to view a map of GIS layers right inside of VS Code. This is helpful for double checking that the layer looks correct without loading it into a GIS application. | :*Has the ability to view a map of GIS layers right inside of VS Code. This is helpful for double checking that the layer looks correct without loading it into a GIS application. | ||
+ | :*An example of its functionality is shown below. | ||
+ | <b>Note:</b> This extension only supports certain file formats, including Shapefile. It does not support GeoPackage or GeoTiff files. | ||
+ | <br>{{Video|name=Animation_geo_data_viewer.mp4|width=900}} | ||
+ | <br> |
Latest revision as of 10:52, 5 April 2024
Introduction
Visual Studio Code (commonly referred to as VS Code) is a free source code editor developed by Microsoft. It can be downloaded here. It supports a variety of file types and can be used to work with TUFLOW control files.
Thousands of free plugins exist for VS Code and some of them are useful when working with TUFLOW models.
TUFLOW VS Code Plugin
The TUFLOW plugin provides syntax highlighting support. Thanks to Daniel Copelin for creating the TUFLOW plugin. One feature of VS Code is that it includes an explorer window from a root folder, so it is easy to navigate the files within a project.
Install TUFLOW Plugin
The TUFLOW Plugin can be installed like any other VS Code plugins. In the VS Code application:
- Select 'Extensions' from the toolbar on the right-hand side.
- Search for 'TUFLOW'.
- Select install.
In VS Code, it is possible to create and edit TUFLOW models and their control files.
- Select File > Open Folder and navigate to the model folder. This will open the model folder into the 'Explorer' panel.
- Now, from the Explorer panel, it is possible to navigate through the model folders and edit control files.
- Using the Open File plugin, it is possible to easily navigate between files.
Running TUFLOW
To run TUFLOW through VS Code, the Batch Runner extension is required. Once installed, TUFLOW can be run by either:
- Right clicking the batch file in the explorer panel and selecting 'Run Batch File', or
- Open the batch file into the editor, and press the 'Run' button.
This will open a terminal and the TUFLOW simulation will run.
Other Useful Plugins
In addition to the TUFLOW plugin, some useful plugins for working with TUFLOW include:
Open File
- Open File by Frank Stuetzer or similar is a free plugin available for download here.
- Right-click on a filename and select 'Open file under cursor'. If the file is found by VS Code, then the selected file will open in a new tab.
- To open multiple files, hold down Alt while selecting the filenames, then right click and select 'Open file under cursor'. If the files are found by VS Code, then the selected files will each open in a new tab.
Path Autocomplete
- Path Autocomplete by Mihai Vilcu is a free plugin available for download here.
- Adds auto-complete when it determines a filename is being written. For this feature to work, set the 'triggerOutsideStrings' to true (as described in the plugin details).
- From the file menu, choose File\Preferences\Settings. Then select 'path-autocomplete' under 'Extensions'.
- Toggle on the 'Trigger Outside Strings' in the settings on the right.
- An example of its functionality is shown below.
Geo Data Viewer
- Geo Data Viewer by Random Fractals inc is a free plugin available for download here.
- Has the ability to view a map of GIS layers right inside of VS Code. This is helpful for double checking that the layer looks correct without loading it into a GIS application.
- An example of its functionality is shown below.
Note: This extension only supports certain file formats, including Shapefile. It does not support GeoPackage or GeoTiff files.