├── .gitignore ├── README.md ├── examples └── debug_launch_args │ ├── Cargo.toml │ ├── README.md │ ├── launch.vs.json │ └── src │ └── main.rs ├── getting_started.md ├── release_notes.md ├── sgrust_debug_target_toolbar.png ├── sgrust_error.png ├── sgrust_rusqlite_intellisense.png ├── sgrust_rust_view_bevy.png ├── sgrust_screenshot.png ├── sgrust_set_startup_project.png ├── sgrust_template.png ├── sgrust_test_explorer_wasmtime.png ├── vs_change_views_button.png ├── vs_create_new_project.png ├── vs_manage_rust.png ├── vs_open_folder.png ├── vs_select_folder.png ├── vs_updates_available.png └── vs_views.png /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SourceGear Rust 2 | 3 | ![screenshot](sgrust_screenshot.png) 4 | 5 | This GitHub repo is a place where users of the 6 | SourceGear Rust Visual Studio extension can ask questions, 7 | log issues, and find information. 8 | 9 | - [Getting Started](getting_started.md) 10 | - [Release Notes](release_notes.md) 11 | - [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=SourceGear.SourceGearRust) 12 | 13 | -------------------------------------------------------------------------------- /examples/debug_launch_args/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "debug_launch_args" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /examples/debug_launch_args/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## How to configure debug launch arguments 3 | 4 | Visual Studio's Open Folder mode allows configuring the 5 | arguments for a debugger launch using a `launch.vs.json` 6 | file. This file can be placed in the `.vs` directory, 7 | or, as in this example, as a sibling to `Cargo.toml`. 8 | 9 | ``` 10 | { 11 | "version": "0.2.1", 12 | "defaults": { 13 | }, 14 | "configurations": [ 15 | { 16 | "type": "default", 17 | "name": "Bin: debug_launch_args/debug_launch_args", 18 | "project": "Cargo.toml", 19 | "projectTarget": "debug_launch_args/debug_launch_args/bin", 20 | "args": 21 | [ 22 | "--flag", 23 | "value" 24 | ] 25 | } 26 | ] 27 | } 28 | ``` 29 | 30 | - `type` must be "default" 31 | - `projectTarget` is the three things, separated by slashes: the name of the package, the name of the target, and the kind of the target. 32 | - `project` must be "Cargo.toml" 33 | - `name` must be the name as it appears in the dropdown control in the toolbar. 34 | - `args` is a json array of strings, which will be the arguments passed to the executable being debugged 35 | 36 | The `launch.vs.json` feature is documented at: 37 | 38 | https://learn.microsoft.com/en-us/visualstudio/ide/customize-build-and-debug-tasks-in-visual-studio?view=vs-2022 39 | 40 | If you right-click on a target in Rust View and choose "Open Debug and Launch Settings", it will bring up the `launch.vs.json` file, and all of the fields except `args` should be pre-filled correctly. 41 | 42 | 43 | -------------------------------------------------------------------------------- /examples/debug_launch_args/launch.vs.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.1", 3 | "defaults": { 4 | }, 5 | "configurations": [ 6 | { 7 | "type": "default", 8 | "name": "Bin: debug_launch_args/debug_launch_args", 9 | "project": "Cargo.toml", 10 | "projectTarget": "debug_launch_args/debug_launch_args", 11 | "args": 12 | [ 13 | "--flag", 14 | "value" 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/debug_launch_args/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | fn main() { 4 | let args: Vec = env::args().collect(); 5 | dbg!(args); 6 | } 7 | -------------------------------------------------------------------------------- /getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | This guide is current as of version 1.0. 4 | 5 | For a list of highlights about each release, see the [Release Notes](release_notes.md). 6 | 7 | ## Install the extension 8 | 9 | SourceGear Rust is available in the Visual Studio 10 | Marketplace. It is compatible with Visual Studio 2022 11 | for Windows, including the Community, Professional, or Enterprise editions. 12 | Other products in the Visual Studio family 13 | (Visual Studio for Mac, Visual Studio Code) are not supported. 14 | 15 | The download for SourceGear Rust is a single file with 16 | a name ending in `.vsix`. This kind of file is the standard format for 17 | Visual Studio extensions, and such a file is often referred to as "a VSIX", 18 | 19 | One way to install SourceGear Rust is to download the VSIX 20 | from the Visual Studio Marketplace website: 21 | 22 | https://marketplace.visualstudio.com/items?itemName=SourceGear.SourceGearRust 23 | 24 | Close Visual Studio itself, and then open the VSIX file, which will bring up 25 | the VSIX Installer. This will configure the extension for your installation 26 | of Visual Studio. 27 | 28 | Another approach is to use the Manage Extensions feature 29 | within Visual Studio. If you install a VSIX from there, it will be 30 | scheduled for install, and The VSIX Installer will be launched after 31 | you close Visual Studio. 32 | 33 | Either way, after the VSIX is installed, the Rust features should 34 | be available the next time you launch Visual Studio. 35 | 36 | ## Install the Rust development tools 37 | 38 | SourceGear Rust needs the usual Rust development tools to be 39 | installed and available in your PATH. These include the Rust compiler and its package 40 | manager (Cargo) and various other things to support 41 | development with Rust. 42 | 43 | The standard tool for managing a Rust installation 44 | is called `rustup`: 45 | 46 | https://rustup.rs/ 47 | 48 | If you like, you can maintain your Rust installation 49 | using `rustup` on the command line. 50 | 51 | Alternatively, 52 | the SourceGear Rust extension can help with this task. 53 | When SourceGear Rust is activated, it checks to see 54 | if the necessary Rust development tools are available. 55 | If something is missing or out-of-date, an information 56 | bar will be displayed: 57 | 58 | ![screenshot](vs_updates_available.png) 59 | 60 | The UI for managing the Rust tools installation looks 61 | like this: 62 | 63 | ![screenshot](vs_manage_rust.png) 64 | 65 | ## About Rust projects in Visual Studio 66 | 67 | SourceGear Rust is based on Visual Studio's "Open Folder" 68 | mode instead of project files and solutions. This mode was 69 | added to Visual Studio to support build environments which have 70 | their own build system and therefore do not benefit from MSBuild. 71 | Other examples of extensions which use Open Folder include 72 | CMake, node.js, and Python. 73 | 74 | To open a Rust project in Visual Studio, in the dialog box 75 | where Visual Studio asks "What would you like to do?", choose 76 | the "Open a local folder" button. 77 | 78 | ![screenshot](vs_open_folder.png) 79 | 80 | Navigate to the folder containing your Cargo.toml file, and 81 | click the Select Folder button. 82 | 83 | ![screenshot](vs_select_folder.png) 84 | 85 | Note that Visual Studio's Open Folder mode can open any folder, 86 | regardless of 87 | what extensions are present. The SourceGear Rust extension 88 | recognizes the Cargo.toml and Rust language files and provides Rust-specific features, such as the ability 89 | to build and debug, etc. 90 | 91 | ## Creating a new Rust project 92 | 93 | As a starting point, SourceGear Rust can create a new project 94 | with a template. 95 | 96 | ![screenshot](vs_create_new_project.png) 97 | 98 | The template(s) can be found by filtering on Rust as 99 | the language: 100 | 101 | ![screenshot](sgrust_template.png) 102 | 103 | ## Intellisense 104 | 105 | SourceGear Rust includes support for rust-analyzer to provide 106 | Intellisense-style features. For example, in the following 107 | screenshot, after typing the dot after `s`, a list of 108 | possibilities is displayed. 109 | 110 | ![screenshot](sgrust_rusqlite_intellisense.png) 111 | 112 | Just as with cargo and the Rust compiler itself, the rust-analyzer executable is 113 | installed by `rustup`. The extension will let you know if it 114 | needs to be installed or updated. 115 | 116 | ## Rust View 117 | 118 | When using Open Folder mode, the Solution Explorer provides 119 | Folder View, which shows the files and folders in the 120 | folder you opened. Right-click on items to see a context 121 | menu which contain appropriate operations. 122 | 123 | SourceGear Rust provides an alternate view which shows 124 | the hierarchy of Cargo packages, targets, and dependencies. 125 | Most of the items 126 | in this view do not correspond to files or folders in the 127 | file system. 128 | 129 | To reach this view, there is a button on the Solution Explorer 130 | toolbar which allows you to switch between available views: 131 | 132 | ![screenshot](vs_change_views_button.png) 133 | 134 | When you click this button, you should see a list of views, 135 | and Rust View should be one of them: 136 | 137 | ![screenshot](vs_views.png) 138 | 139 | If you choose Rust View, you should now see a hierarchy of 140 | Cargo packages and targets and so on. 141 | 142 | ![screenshot](sgrust_rust_view_bevy.png) 143 | 144 | In the screenshot above, the Cargo workspace for the bevy project 145 | contains a number of 146 | packages. The top-level package is called `bevy`, and it 147 | contains a library target (also called `bevy`), several 148 | dependencies, some example targets, and some tests. 149 | 150 | One thing you can do from Rust View is set which target is 151 | designated for debugging. Open the Examples folder, right 152 | click on the "3d\_shapes" target, and the context menu should 153 | include the "Set as Startup Project" menu item. Choosing this 154 | will set the Startup Item in the Visual Studio toolbar accordingly. 155 | 156 | ![screenshot](sgrust_debug_target_toolbar.png) 157 | 158 | Tapping the launch button to start the debugger should cause 159 | the "3d\_shapes" example to be built and launched. 160 | 161 | ## Error List 162 | 163 | Rust compiler errors are shown in the Visual Studio Error List: 164 | 165 | ![screenshot](sgrust_error.png) 166 | 167 | If you double-click on an item in the Error List, the corresponding 168 | source code file will be opened at the location of the error or 169 | warning. 170 | 171 | -------------------------------------------------------------------------------- /release_notes.md: -------------------------------------------------------------------------------- 1 | # Release notes 2 | 3 | SourceGear Rust is an extension for Visual Studio 2022. 4 | 5 | - Intellisense features (using rust-analyzer) 6 | - Syntax coloring for .rs and .toml 7 | - Build, Clean, etc 8 | - Debugging 9 | - Rust View, showing Cargo package/target/dependency hierarchy 10 | - Template to create a new project 11 | - Manage the installation of Rust tools from within Visual Studio 12 | 13 | For a more detailed overview, see [Getting Started](getting_started.md). 14 | 15 | ## Roadmap 16 | 17 | The 1.0 release is considered a "Minimum Viable Product", 18 | suitable for production use, and a stable foundation on which to build 19 | more features. We plan to continue improving the extension 20 | and making regular releases. 21 | 22 | In the future, probably in the 2.0 time frame, we plan to offer both 23 | free and commercial editions of this extension. 24 | 25 | ## 1.3 -- (29-January-2024) 26 | 27 | Changes in this release: 28 | 29 | - Fix a problem with Rust View that shows up with Visual Studio 17.8 30 | 31 | ## 1.2 -- (23-August-2023) 32 | 33 | Changes in this release: 34 | 35 | - New UI for managing dependencies 36 | 37 | ## 1.1 -- (14-February-2023) 38 | 39 | Changes in this release: 40 | 41 | - New UI for debug configurations 42 | - Run `cargo test` from with the IDE 43 | - Support for Arm64 Visual Studio 44 | 45 | ## 1.0 -- (30-January-2023) 46 | 47 | Changes in this release: 48 | 49 | - Bug fixes 50 | 51 | ## 0.8 -- (9-January-2023) 52 | 53 | Although this remains a "Preview", we are finding it 54 | generally satisfactory for regular development work. 55 | 56 | We will be focused on bug fixes and polishing from 57 | here until 1.0. Feedback is welcome. 58 | 59 | Changes in this preview release: 60 | 61 | - Support for Rust language options and the "map mode" scrollbar 62 | - Obtain (and update) rust-analayzer from rustup 63 | - Improvements to the handling of messages in Error List 64 | - Various improvements to 'rustup' UI features 65 | - Other bug fixes and performance improvements 66 | 67 | ## 0.7 -- (9-December-2022) 68 | 69 | This extension remains far from polished, and is not yet feature complete, 70 | but we are now able to use it productively in actual Rust development work. 71 | 72 | Changes in this preview release: 73 | 74 | - The bundled copy of rust-analyzer has been updated 75 | - The project template feature has been brought back 76 | - New 'rustup' features to manage the installation and updates of Rust tools 77 | - Integration with Test Explorer has been removed, for now 78 | - Added a dropdown to the toolbar to configure profile for Build All 79 | - Lots of bug fixes 80 | 81 | ## 0.6 -- (18-October-2022) 82 | 83 | Still rough. Released to show direction and progress: 84 | 85 | - Use Visual Studio's Open Folder mode 86 | - Rust View, showing Cargo package/target/dependency hierarchy 87 | - Show Rust compiler error messages in Visual Studio Error List 88 | - Support for cargo workspaces with multiple packages 89 | - Initial integration of Cargo tests with Test Explorer 90 | - Comment/Uncomment for Rust code in editor 91 | - Project template features temporarily removed 92 | - No longer requires admin privileges to install 93 | 94 | ## 0.5 -- (04-August-2022) 95 | 96 | Initial public preview release, with a very basic feature set: 97 | 98 | - Intellisense features (using rust-analyzer) 99 | - Project file (`.rsproj`) wrapping `Cargo.toml` 100 | - Build, Rebuild, etc 101 | - Debugging 102 | - Syntax coloring for `.rs` and `.toml` 103 | - Templates for new Rust projects 104 | - Open existing `Cargo.toml` as a project 105 | 106 | -------------------------------------------------------------------------------- /sgrust_debug_target_toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_debug_target_toolbar.png -------------------------------------------------------------------------------- /sgrust_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_error.png -------------------------------------------------------------------------------- /sgrust_rusqlite_intellisense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_rusqlite_intellisense.png -------------------------------------------------------------------------------- /sgrust_rust_view_bevy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_rust_view_bevy.png -------------------------------------------------------------------------------- /sgrust_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_screenshot.png -------------------------------------------------------------------------------- /sgrust_set_startup_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_set_startup_project.png -------------------------------------------------------------------------------- /sgrust_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_template.png -------------------------------------------------------------------------------- /sgrust_test_explorer_wasmtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/sgrust_test_explorer_wasmtime.png -------------------------------------------------------------------------------- /vs_change_views_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_change_views_button.png -------------------------------------------------------------------------------- /vs_create_new_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_create_new_project.png -------------------------------------------------------------------------------- /vs_manage_rust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_manage_rust.png -------------------------------------------------------------------------------- /vs_open_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_open_folder.png -------------------------------------------------------------------------------- /vs_select_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_select_folder.png -------------------------------------------------------------------------------- /vs_updates_available.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_updates_available.png -------------------------------------------------------------------------------- /vs_views.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sourcegear/rust-vs-extension/01137bf0cf47ff0ba1b25d444c99afcb7017eafb/vs_views.png --------------------------------------------------------------------------------