├── .eslintrc.json ├── .gitignore ├── .prettierrc.json ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── .yarnrc ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── icons ├── icon.png ├── icon.xcf ├── icon_alt.png ├── logo.png └── views │ └── icon.svg ├── images ├── feature-editor-2.gif ├── feature-editor-collapsed.jpg ├── feature-editor.gif ├── feature-game-exception.gif └── feature-run-game.gif ├── l10n ├── bundle.l10n.es.json └── bundle.l10n.json ├── package.json ├── package.nls.es.json ├── package.nls.json ├── src ├── extension.ts └── modules │ ├── context │ └── vscode_context.ts │ ├── manager.ts │ ├── processes │ ├── gameplay_controller.ts │ ├── open_folder.ts │ └── scripts_controller.ts │ ├── ui │ ├── elements │ │ ├── ui_status_bar.ts │ │ └── ui_tree_view_provider.ts │ └── ui_extension.ts │ └── utils │ ├── configuration.ts │ ├── fileutils.ts │ ├── filewatcher.ts │ ├── logger.ts │ └── strings.ts ├── tsconfig.json ├── vsc-extension-quickstart.md └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": [ 13 | "warn", 14 | { 15 | "selector": "import", 16 | "format": [ "camelCase", "PascalCase" ] 17 | } 18 | ], 19 | "@typescript-eslint/semi": "warn", 20 | "curly": "warn", 21 | "eqeqeq": "warn", 22 | "no-throw-literal": "warn", 23 | "semi": "off" 24 | }, 25 | "ignorePatterns": [ 26 | "out", 27 | "dist", 28 | "**/*.d.ts" 29 | ] 30 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | dist 3 | node_modules 4 | .vscode-test/ 5 | *.vsix 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "printWidth": 80, 4 | "tabWidth": 2, 5 | "useTabs": false, 6 | "semi": true, 7 | "singleQuote": true 8 | } -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ], 15 | "outFiles": [ 16 | "${workspaceFolder}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "${defaultBuildTask}" 19 | }, 20 | { 21 | "name": "Extension Tests", 22 | "type": "extensionHost", 23 | "request": "launch", 24 | "args": [ 25 | "--extensionDevelopmentPath=${workspaceFolder}", 26 | "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" 27 | ], 28 | "outFiles": [ 29 | "${workspaceFolder}/out/test/**/*.js" 30 | ], 31 | "preLaunchTask": "${defaultBuildTask}" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 10 | "typescript.tsc.autoDetect": "off", 11 | "cmake.configureOnOpen": false 12 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/.eslintrc.json 9 | **/*.map 10 | **/*.ts 11 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | --ignore-engines true -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "rgss-script-editor" extension will be documented in this file. 4 | 5 | ## [1.5.5] - 21/05/2025 6 | 7 | ### Fixed 8 | 9 | - Fixed bad file descriptor errors in the extension script loader 10 | - File descriptor is redirected to null (supressed) until process allocates the console 11 | 12 | ## [1.5.4] - 20/05/2025 13 | 14 | ### Fixed 15 | 16 | - Fixed file system watcher resetting section load order 17 | 18 | ## [1.5.3] - 20/05/2025 19 | 20 | ### Fixed 21 | 22 | - Assign the appropriate loading status when creating new sections 23 | 24 | ## [1.5.2] - 19/05/2025 25 | 26 | ### Fixed 27 | 28 | - Fixed section checkbox state forced to true when creating sections 29 | 30 | ## [1.5.1] - 19/05/2025 31 | 32 | ### Fixed 33 | 34 | - Fixed input window not showing the full list of invalid characters 35 | 36 | ## [1.5.0] - 19/05/2025 37 | 38 | ### Added 39 | 40 | - Localization support 41 | - Added spanish localization 42 | - Cut & Paste operations on the script editor 43 | - You can select a list of sections to cut and paste in the extension's script editor 44 | - All sections will move to the target avoiding overwrites 45 | - Added a new command to copy the absolute path to the clipboard of a any section or sections 46 | - Added a new command to copy the relative path to the clipboard of a any section or sections 47 | - Added a new command to create a backup file of the current load order 48 | - Added script name validation setting 49 | - Allows the extension to validate script names to meet the requirements of RPG Maker based on the Ruby version used 50 | - Added a setting to insert encoding magic comment 51 | - Since v1.5.0 the enconding magic comment is no longer needed 52 | - Although, you can optionally enable this setting to insert them into scripts 53 | 54 | ### Changed 55 | 56 | - Changed loader script from using `Kernel.require` and `Kernel.load` to `Kernel.eval` to load script files. 57 | - Modified loader script to not suppress exceptions when creating the game log file 58 | - Improved regular expressions to match invalid characters, depending on RGSS version 59 | - Validation of invalid characters is much more permissive now, allowing wide characters when supported. 60 | - Modified section move operations to avoid overwriting sections in target folder 61 | - Forced import operations to always create a folder, avoiding overwriting sections 62 | - Improved script controller logic, should be more stable and efficient now 63 | - Removed section priority attribute and used the position in the children array to determine their priority 64 | - README has been improved to make it clearer and easier to read 65 | - Improved description for all extension settings 66 | 67 | ### Fixed 68 | 69 | - Fixed the problem that caused different scripts with the same name to be overwritten when extracting 70 | - Fixed bugged tree view editor when changing between workspace projects 71 | - The script editor view was unnecessarily re-created between workspace changes 72 | - Fixed drag & drop (section move) raising errors when the section was dropped in self or inside a child section 73 | - Fixed empty icons for separators 74 | 75 | ## [1.4.1] - 13/09/2024 76 | 77 | ### Changed 78 | 79 | - Removed unnecesary refresh call on the editor section expand/collapse callbacks 80 | - Script reveals on the editor view should be faster now on projects with many subfolders in depth 81 | - Removed work-around to reveal editor section with 3 levels of depth or more 82 | 83 | ### Fixed 84 | 85 | - Tree data item not found errors when revealing script sections on the script editor view 86 | 87 | ## [1.4.0] - 16/07/2024 88 | 89 | ### Added 90 | 91 | - Added configuration to change the log files path 92 | - Moved all the extension's files and folders inside a parent folder to make it tidier 93 | - The script loader is now re-created when the game log file path is changed 94 | - Drag and drop sections (folder/scripts) on the VSCode editor 95 | - You can drop sections from the extension's tree view directly on the editor 96 | - When a folder is dropped it will open all sections inside recursively 97 | - You can drop sections on different columns 98 | - Compile enabled scripts using a keybind 99 | - You can use a keybind (CTRL+F5 by default) to quickly compile the current enabled scripts 100 | - The bundle file name is set to Scripts to match the RPG Maker bundle file name 101 | - You can use this to automatize the creation of a bundle file for game distribution. 102 | - Copy and paste sections on the extension's tree view 103 | - You can copy any section on the tree view 104 | - Copied folders will keep all child sections 105 | - All sections will be saved in the clipboard 106 | - Paste any saved section on the clipboard anywhere on the tree 107 | - Pasted sections will make sure not to overwrite existing sections with the same name 108 | 109 | ### Changed 110 | 111 | - Load order file uses the user selected EOL characters when created 112 | - Extension shows an error message when it is not possible to move sections 113 | 114 | ## [1.3.1] - 21/06/2024 115 | 116 | ### Fixed 117 | 118 | - Fixed an issue reveal script on the tree view 119 | - Due to VS Code limitations, the reveal depth allows up to three levels 120 | - The reveal operation failed when the script is more deep than three levels 121 | - Fixed a problem when collapsing and expanding folders 122 | - The extension did not update the collapsible status of the folder 123 | - When the tree was refreshed, the collapsible status was reset to the default state 124 | 125 | ### Changed 126 | 127 | - Changed debug to file option default value to false 128 | - Avoids unnecesary file write calls 129 | - Users can enable it manually when reporting bugs 130 | 131 | ## [1.3.0] - 20/06/2024 132 | 133 | ### Added 134 | 135 | - The extension now automatically re-creates the script loader every time the user opens a folder if the scripts are already extracted 136 | - It is recommended to leave it active, so the extension can update the script loader between updates. 137 | - Optionally, it can be disabled, but the user will have to update the script loader manually with the corresponding command. 138 | - Added run game behavior option 139 | - The user can choose how the extension behaves when trying to launch the game again. 140 | - You can choose between the following behaviors: 141 | - Nothing: Does nothing, this how RPG Maker behaves (default) 142 | - Kill and Run: Kills the current game process and runs it again 143 | - Allow Multiple: Allows the user to start more than one game process at the same time 144 | - Added files EOL (End-of-File) option 145 | - Scripts are now created with the appropriate EOL characters 146 | - You can force the extension to use a specific EOL type (LF, CRLF) 147 | - You can also let the extension determine the appropriate EOL automatically 148 | - This is based on the operating system 149 | - Import scripts from bundle files 150 | - You can import all scripts inside an RPG Maker scripts bundle file 151 | - Optionally, you can allow whether to overwrite existing scripts or not 152 | - Added a file system watcher to detect the output file the game creates when an exception kills the game 153 | - In previous versions, the extension processes the game exception only it the game was launched from VS Code 154 | - If the extension is running. you can launch the game out of VS Code, and it will process the game output file 155 | - Added a new command to reveal a script or folder on the operating system file explorer 156 | - Available in the context menu when selecting a script or a folder in the script editor view 157 | - Added the possibility for developers to reload scripts on runtime **(EXPERIMENTAL)** 158 | - The script loader will load scripts again if a ResetLoader exception is raised 159 | - You can raise this exception anywhere on your code 160 | 161 | ### Fixed 162 | 163 | - The extension now gets the appropriate game process PID instead of the shell process PID 164 | - The game processes are now properly killed when closing VS Code or switching between projects 165 | - Fixed game process Errno::EBADF exceptions 166 | - Errno::EBADF was raised sometimes on RPG Maker VX Ace projects 167 | - The game fails to redirect output to the console output 168 | - Output is redirected to the null device if this happens to avoid crashes 169 | 170 | ### Changed 171 | 172 | - Changed extension's auto process game error option 173 | - If enabled, the extension will automatically show the exception without asking the user to peek the backtrace 174 | - If disabled, it will ask the user before showing the exception information. 175 | 176 | ## [1.2.1] - 02/03/2024 177 | 178 | ### Changed 179 | 180 | - Renamed some commands to make them clearer 181 | - Improved the README file 182 | 183 | ### Fixed 184 | 185 | - Fixed toggle section command not toggling the tree item with right click 186 | - Toggling a section with the context menu (right click) did not work if a section was selected on the tree 187 | 188 | ## [1.2.0] - 29/02/2024 189 | 190 | ### Added 191 | 192 | - A new command to create a bundle file from the current selected editor sections on the tree view 193 | - You can select any group of sections on the tree view and create a bundle including only those sections 194 | - Sections will be included whether they are enabled or disabled 195 | 196 | ### Changed 197 | 198 | - Modified create bundle file and create backup bundle file commands to adapt it to the new feature 199 | - Renamed Create Script Loader command 200 | 201 | ## [1.1.0] - 01/02/2024 202 | 203 | ### Added 204 | 205 | - Extension is now able to create a script tree and load order from a bundled scripts data file 206 | - Only bundled scripts data files created by this extension are supported 207 | - You will be able to restore the tree easily in case it was overwritten 208 | - Allows the user to quickly create a back up file of the current enabled scripts in the tree 209 | - This process is the same as creating a bundle file but does it automatically 210 | - All backups are stored with a time stamp 211 | 212 | ### Changed 213 | 214 | - Avoid creating empty backup files of the bundled scripts data if invalid 215 | - 'Invalid' means that only the script loader was inside of the bundled data file 216 | - Bundle creation now allows to overwrite an existing file 217 | - Modified some logging information to make it clearer 218 | 219 | ### Fixed 220 | 221 | - Fixed folder recognition to avoid empty filesystem entries to be recognized as valid folders 222 | 223 | ## [1.0.11] - 27/01/2024 224 | 225 | ### Changed 226 | 227 | - Reworded the description of the extension settings 228 | - Removed an unnecessary load order refresh call 229 | - Added a warning when deleting sections 230 | - Bundle file created file extension is now automatically appended based on the RGSS version 231 | 232 | ## [1.0.10] - 25/01/2024 233 | 234 | ### Changed 235 | 236 | - Changed save dialog default uri to the project's folder when creating a bundle file for convenience 237 | 238 | ## [1.0.9] - 25/01/2024 239 | 240 | ### Added 241 | 242 | - Added the possibility of modifying the Wine command for Linux users 243 | - Turned Wine setting from a checkbox into an inputbox 244 | 245 | ### Fixed 246 | 247 | - Cleaned the extension's output folder to ensure compatibility with case sensitive file systems 248 | 249 | ## [1.0.8] - 17/01/2024 250 | 251 | ### Added 252 | 253 | - Added an information window when a workspace with more than one valid folder is opened. 254 | - Game exceptions are now displayed with a timestamp of when they occurred. 255 | 256 | ### Fixed 257 | 258 | - Game exceptions are now correctly written to the output file. 259 | - Script loader was writing serialized data in non-binary mode 260 | 261 | ## [1.0.7] - 13/01/2024 262 | 263 | ### Added 264 | 265 | - Added a submenu in the script editor view with some useful commands 266 | - You can create sections now with an empty script editor tree 267 | 268 | ### Changed 269 | 270 | - Logger output channel language id was changed to 'log' to support highlighting 271 | 272 | ### Fixed 273 | 274 | - Logger is now properly disposed when extension is deactivated 275 | 276 | ## [1.0.6] - 12/01/2024 277 | 278 | ### Added 279 | 280 | - Extension now provides a output channel to write log messages 281 | 282 | ### Changed 283 | 284 | - Avoid the extension to restart when a configuration value changes. 285 | - When changing the relative path to the extracted scripts folder, a restart will still trigger to refresh the tree view 286 | 287 | ## [1.0.5] - 07/01/2024 288 | 289 | ### Fixed 290 | 291 | - Avoids extension restarting when an unknown configuration changes 292 | 293 | ## [1.0.4] - 06/01/2024 294 | 295 | ### Added 296 | 297 | - More invalid characters that crashes the game 298 | 299 | ## [1.0.3] - 06/01/2024 300 | 301 | ### Added 302 | 303 | - Avoid unnecesary refresh calls when file system watcher creates an existing editor section 304 | 305 | ## [1.0.2] - 05/01/2024 306 | 307 | ### Fixed 308 | 309 | - RPG Maker XP not skipping ignored script files 310 | 311 | ## [1.0.1] - 05/01/2024 312 | 313 | ### Changed 314 | 315 | - Invalid characters shown on user input window 316 | 317 | ## [1.0.0] - 05/01/2024 318 | 319 | ### Added 320 | 321 | - Initial release 322 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

RGSS Script Editor

6 |

An advanced script editor for RPG Maker XP/VX/VX Ace inside VSCode

7 | 8 | ## 📋 Table of Contents 9 | 10 | - [📋 Table of Contents](#-table-of-contents) 11 | - [✨ Features](#-features) 12 | - [🖼️ Screenshots](#️-screenshots) 13 | - [🛠️ Requirements](#️-requirements) 14 | - [Windows](#windows) 15 | - [Linux](#linux) 16 | - [macOS](#macos) 17 | - [📦 Download](#-download) 18 | - [🚀 Getting Started](#-getting-started) 19 | - [1. Open Your Project Folder](#1-open-your-project-folder) 20 | - [2. Extract Scripts](#2-extract-scripts) 21 | - [3. Use the Script Editor View](#3-use-the-script-editor-view) 22 | - [4. Run Your Game](#4-run-your-game) 23 | - [🐞 Known Issues](#-known-issues) 24 | - [\[SyntaxError\] Invalid Multibyte char (US-ASCII)](#syntaxerror-invalid-multibyte-char-us-ascii) 25 | - [\[LoadError\] no such file to load -- \[Errno::EINVAL\] Invalid argument](#loaderror-no-such-file-to-load----errnoeinval-invalid-argument) 26 | - [File Doesn’t Exist](#file-doesnt-exist) 27 | - [File Exists but Crashes](#file-exists-but-crashes) 28 | - [\[SystemStackError\] stack level too deep](#systemstackerror-stack-level-too-deep) 29 | - [🙏 Contributors](#-contributors) 30 | 31 | ## ✨ Features 32 | 33 | - Seamlessly extract and manage RPG Maker scripts as individual Ruby files. 34 | - Edit the game scripts in VSCode while the RPG Maker editor is open and the game is running. 35 | - Organize your scripts in a tree view: folders and separators with drag & drop support. 36 | - Copy, cut and paste scripts and folders anywhere in the tree view. 37 | - Enable/disable scripts and folders to load or skip them when running the game. 38 | - Run the game directly from VSCode with lots of customizable options. 39 | - Process game exceptions with detailed backtrace visualization inside VSCode. 40 | - RPG Maker default script list hierarchy has been replaced with a tree hierarchy. 41 | - Backup and compile script bundles for distribution. 42 | - Seamlessly change between active folders in the VSCode current workspace. 43 | - File system watcher tracking your project's script folder for changes outside VSCode. 44 | - Use version control software (Git) to track script changes visually on the script editor. 45 | 46 | ## 🖼️ Screenshots 47 | 48 | ![Editor View Collapsed](./images/feature-editor-collapsed.jpg) 49 | 50 | ![Editor View](./images/feature-editor.gif) 51 | 52 | ![Editor View 2](./images/feature-editor-2.gif) 53 | 54 | ![Run Game](./images/feature-run-game.gif) 55 | 56 | ![Game Exception](./images/feature-game-exception.gif) 57 | 58 | ## 🛠️ Requirements 59 | 60 | ### Windows 61 | 62 | - [Visual Studio Code](https://code.visualstudio.com/) 63 | 64 | ### Linux 65 | 66 | - [Visual Studio Code](https://code.visualstudio.com/) 67 | - [Wine](https://www.winehq.org/) (preferably the latest version) 68 | - Wine should available on your system, which will be used to run the Windows game executable. 69 | - You can check if Wine is installed in your system with: `wine --version` 70 | - **IMPORTANT: If you use MKXP-Z for Linux you won't need to install Wine.** 71 | - Wine is only required for RPG Maker Windows executables. 72 | - You can also use any other Wine fork with this extension. 73 | 74 | ### macOS 75 | 76 | - [Visual Studio Code](https://code.visualstudio.com/) 77 | - **⚠️ Not officially tested ⚠️** 78 | 79 | ## 📦 Download 80 | 81 | - [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=SnowSzn.rgss-script-editor) 82 | - [Open VSX Marketplace](https://open-vsx.org/extension/SnowSzn/rgss-script-editor) 83 | 84 | ## 🚀 Getting Started 85 | 86 | ### 1. Open Your Project Folder 87 | 88 | Open the **root folder** of your RPG Maker project in VS Code (the one containing `Game.exe`). The extension will attempt to detect your RPG Maker version by checking for one of the following files in the data folder: 89 | 90 | - `Data/Scripts.rxdata` (XP) 91 | - `Data/Scripts.rvdata` (VX) 92 | - `Data/Scripts.rvdata2` (VX Ace) 93 | 94 | **If this data file is missing the extension won't work!** 95 | 96 | ### 2. Extract Scripts 97 | 98 | When opening the project for the first time, the extension will prompt you to extract all scripts from the bundled file into individual Ruby `.rb` files. A **backup** of the original file is automatically created. 99 | 100 | You can change the script output folder in the extension settings. 101 | 102 | From now on, you should get rid of the RPG Maker script editor and create and manage scripts using the extension's editor in VS Code. 103 | 104 | If you create new scripts using the native RPG Maker editor, that's still possible—but you'll need to extract them again before the extension can work with them properly. 105 | 106 | ### 3. Use the Script Editor View 107 | 108 | A new icon will appear in the VS Code activity bar (usually at the left of the editor): 109 | 110 | This opens the **Script Editor View**, where you can manage scripts using folders, separators, drag-and-drop, enable/disable sections, rename, and more. 111 | 112 | This view also determines the **load order** of the scripts when running the game. 113 | 114 | You can toggle any section load status with each item checkbox. 115 | 116 | If an item checkbox is not checked it won't be loaded when the game is executed. 117 | 118 | ### 4. Run Your Game 119 | 120 | Press `F12` or use the button in the UI to launch your game. You can customize arguments and execution behavior (e.g., restart running instances) via the extension settings. 121 | 122 | ## 🐞 Known Issues 123 | 124 | ### \[SyntaxError] Invalid Multibyte char (US-ASCII) 125 | 126 | **Applies only to extension versions before v1.5.0** 127 | 128 | Ruby cannot determine file encoding without a magic comment. If you see this error, make sure the script starts with: 129 | 130 | ```ruby 131 | # encoding: utf-8 132 | ``` 133 | 134 | Enable the setting `rgssScriptEditor.extension.insertEncodingComment` to have this added automatically. 135 | 136 | --- 137 | 138 | ### \[LoadError] no such file to load -- \[Errno::EINVAL] Invalid argument 139 | 140 | #### File Doesn’t Exist 141 | 142 | Ensure the file exists and is correctly listed in `load_order.txt`. Scripts can be skipped using `#` at the start of the line. 143 | 144 | #### File Exists but Crashes 145 | 146 | Older RPG Maker versions using Ruby <1.9 cannot handle special characters in file paths. 147 | 148 | Avoid using characters like `■` or `▼` in filenames, also wide characters like japanese or chinese causes this error too. 149 | 150 | The versions of RPG Maker affected are: 151 | 152 | - RPG Maker XP 153 | - RPG Maker VX 154 | 155 | Valid script names should only contain ASCII letters: 156 | 157 | ``` 158 | Good: Script_1.rb, My-Script.rb 159 | Bad: ▼ Script.rb, スクリプト.rb 160 | ``` 161 | 162 | **If you use MKXP-Z or any other implementation that is based in Ruby v1.9+ (RPG Maker VX Ace), this restriction doesn’t apply.** 163 | 164 | Please set the setting `rgssScriptEditor.extension.scriptNameValidation` to `auto` or `enabled` to let the extension remove invalid characters from script names. Only disable this setting if you are sure the Ruby version you are using is safe using wide characters. 165 | 166 | --- 167 | 168 | ### \[SystemStackError] stack level too deep 169 | 170 | Occurs when reloading the script loader at runtime, usually due to aliasing methods repeatedly. 171 | 172 | Example problematic code: 173 | 174 | ```ruby 175 | class Scene_Base 176 | alias reset_script_loader update 177 | def update 178 | reset_script_loader 179 | raise ScriptLoader::ResetLoader if Input.press?(:F5) 180 | end 181 | end 182 | ``` 183 | 184 | Use a check before aliasing: 185 | 186 | ```ruby 187 | class Scene_Base 188 | alias reset_script_loader update unless method_defined?(:reset_script_loader) 189 | def update 190 | reset_script_loader 191 | raise ScriptLoader::ResetLoader if Input.press?(:F5) 192 | end 193 | end 194 | ``` 195 | 196 | **This feature is very experimental and can lead to undefined behavior. Use with caution.** 197 | 198 | ## 🙏 Contributors 199 | 200 | - [marshal](https://github.com/hyrious/marshal) 201 | -------------------------------------------------------------------------------- /icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/icons/icon.png -------------------------------------------------------------------------------- /icons/icon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/icons/icon.xcf -------------------------------------------------------------------------------- /icons/icon_alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/icons/icon_alt.png -------------------------------------------------------------------------------- /icons/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/icons/logo.png -------------------------------------------------------------------------------- /icons/views/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 59 | -------------------------------------------------------------------------------- /images/feature-editor-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/images/feature-editor-2.gif -------------------------------------------------------------------------------- /images/feature-editor-collapsed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/images/feature-editor-collapsed.jpg -------------------------------------------------------------------------------- /images/feature-editor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/images/feature-editor.gif -------------------------------------------------------------------------------- /images/feature-game-exception.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/images/feature-game-exception.gif -------------------------------------------------------------------------------- /images/feature-run-game.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SnowSzn/rgss-script-editor/53ef9aa6a92b7dcc5f6c6265fb1d4fc8cc7d343e/images/feature-run-game.gif -------------------------------------------------------------------------------- /l10n/bundle.l10n.es.json: -------------------------------------------------------------------------------- 1 | { 2 | "Several RPG Maker folders were detected in the current workspace, choose one to set it as active.": "Se detectaron varias carpetas de RPG Maker en el espacio de trabajo actual, elige una para establecerla como activa.", 3 | "Close": "Cerrar", 4 | "Some scripts were detected inside the RPG Maker scripts file, you should extract them now.": "Se detectaron algunos scripts dentro del archivo de scripts de RPG Maker, deberías extraerlos ahora.", 5 | "Choose the RPG Maker active project folder": "Elige la carpeta del proyecto activo de RPG Maker", 6 | "\"{0}\" workspace folder opened successfully!": "¡La carpeta \"{0}\" se abrió correctamente!", 7 | "Failed to open the folder, a valid RGSS version was not detected.": "No se pudo abrir la carpeta, no se detectó una versión válida de RGSS.", 8 | "Something went wrong! Please check RGSS Script Editor output channel for more information.": "¡Algo salió mal! Por favor, revisa el canal de salida de RGSS Script Editor para más información.", 9 | "'Cannot create script loader because RPG Maker bundle file still has valid scripts inside of it!'": "¡No se puede crear el cargador de scripts porque el fichero compilado de RPG Maker aún contiene scripts válidos!", 10 | "The script loader was created successfully!": "¡El cargador de scripts se creó correctamente!", 11 | "The backup bundle file was created successfully!": "¡El archivo de respaldo de los scripts de RPG Maker se creó correctamente!", 12 | "Load order backup created!": "¡Respaldo del orden de carga creado!", 13 | "The bundle file was created successfully!": "¡El fichero compilado se creó correctamente!", 14 | "You must select at least one section on the tree view to create the bundle file!": "¡Debes seleccionar al menos una sección en la vista en árbol para crear el fichero compilado!", 15 | "Scripts were compiled successfully!": "¡Los scripts se compilaron correctamente!", 16 | "No exception was reported in the last game session.": "No se reportaron excepciones en la última sesión del juego.", 17 | "An exception was reported in the last game session.": "Se reportó una excepción en la última sesión del juego.", 18 | "Peek Backtrace": "Ver Rastreo", 19 | "Create a new section at: {0}": "Crear una nueva sección en: {0}", 20 | "Choose new section type...": "Elegir tipo de nueva sección...", 21 | "Create Script": "Crear script", 22 | "Create Folder": "Crear carpeta", 23 | "Create Separator": "Crear separador", 24 | "Type a name for the new section...": "Escribe un nombre para la nueva sección...", 25 | "Deleting: {0}": "Eliminando: {0}", 26 | "Are you sure you want to delete the selected sections? (This is irreversible)": "¿Estás seguro de que deseas eliminar las secciones seleccionadas? (Esto es irreversible)", 27 | "Delete section (This is irreversible)": "Eliminar sección (Esto es irreversible)", 28 | "Cancel section deletion": "Cancelar eliminación de sección", 29 | "Renaming: {0}": "Renombrando: {0}", 30 | "Type a new name for this section...": "Escribe un nuevo nombre para esta sección...", 31 | "Merge": "Combinar", 32 | "Move": "Mover", 33 | "Unknown": "Desconocido", 34 | "Current Editor Mode: {0}": "Modo actual del editor: {0}", 35 | "Choose the editor mode...": "Elegir el modo del editor...", 36 | "Input contains invalid characters or words! ({0})": "¡La entrada contiene caracteres o palabras no válidos! ({0})", 37 | "An editor section already exists with the given input!": "¡Ya existe una sección con la entrada proporcionada!", 38 | "RGSS Script Editor: Set Project Folder": "RGSS Script Editor: Establecer Carpeta del Proyecto", 39 | "Choose RPG Maker Project Folder": "Elegir Proyecto de RPG Maker", 40 | "Choose a RPG Maker project folder from the current workspace to activate it": "Elige una carpeta de proyecto de RPG Maker del espacio de trabajo actual para activarla", 41 | "RGSS Script Editor: Active Project Folder": "RGSS Script Editor: Carpeta de Proyecto Activa", 42 | "RPG Maker Active Project: {0}": "Proyecto Activo de RPG Maker: {0}", 43 | "Opens the current active RPG Maker project folder": "Abre la carpeta del proyecto activo de RPG Maker", 44 | "RGSS Script Editor: Run Game": "RGSS Script Editor: Ejecutar Juego", 45 | "Run Game": "Ejecutar Juego", 46 | "Runs the game executable": "Ejecuta el juego", 47 | "RGSS Script Editor: Extract Scripts": "RGSS Script Editor: Extraer Scripts", 48 | "Extract Scripts": "Extraer Scripts", 49 | "Extracts all scripts from the bundled RPG Maker scripts file": "Extrae todos los scripts del archivo empaquetado de scripts de RPG Maker" 50 | } -------------------------------------------------------------------------------- /l10n/bundle.l10n.json: -------------------------------------------------------------------------------- 1 | { 2 | "Several RPG Maker folders were detected in the current workspace, choose one to set it as active.": "Several RPG Maker folders were detected in the current workspace, choose one to set it as active.", 3 | "Close": "Close", 4 | "Some scripts were detected inside the RPG Maker scripts file, you should extract them now.": "Some scripts were detected inside the RPG Maker scripts file, you should extract them now.", 5 | "Choose the RPG Maker active project folder": "Choose the RPG Maker active project folder", 6 | "\"{0}\" workspace folder opened successfully!": "\"{0}\" workspace folder opened successfully!", 7 | "Failed to open the folder, a valid RGSS version was not detected.": "Failed to open the folder, a valid RGSS version was not detected.", 8 | "Something went wrong! Please check RGSS Script Editor output channel for more information.": "Something went wrong! Please check RGSS Script Editor output channel for more information.", 9 | "'Cannot create script loader because RPG Maker bundle file still has valid scripts inside of it!'": "'Cannot create script loader because RPG Maker bundle file still has valid scripts inside of it!'", 10 | "The script loader was created successfully!": "The script loader was created successfully!", 11 | "The backup bundle file was created successfully!": "The backup bundle file was created successfully!", 12 | "Load order backup created!": "Load order backup created!", 13 | "The bundle file was created successfully!": "The bundle file was created successfully!", 14 | "You must select at least one section on the tree view to create the bundle file!": "You must select at least one section on the tree view to create the bundle file!", 15 | "Scripts were compiled successfully!": "Scripts were compiled successfully!", 16 | "No exception was reported in the last game session.": "No exception was reported in the last game session.", 17 | "An exception was reported in the last game session.": "An exception was reported in the last game session.", 18 | "Peek Backtrace": "Peek Backtrace", 19 | "Create a new section at: {0}": "Create a new section at: {0}", 20 | "Choose new section type...": "Choose new section type...", 21 | "Create Script": "Create Script", 22 | "Create Folder": "Create Folder", 23 | "Create Separator": "Create Separator", 24 | "Type a name for the new section...": "Type a name for the new section...", 25 | "Deleting: {0}": "Deleting: {0}", 26 | "Are you sure you want to delete the selected sections? (This is irreversible)": "Are you sure you want to delete the selected sections? (This is irreversible)", 27 | "Delete section (This is irreversible)": "Delete section (This is irreversible)", 28 | "Cancel section deletion": "Cancel section deletion", 29 | "Renaming: {0}": "Renaming: {0}", 30 | "Type a new name for this section...": "Type a new name for this section...", 31 | "Merge": "Merge", 32 | "Move": "Move", 33 | "Unknown": "Unknown", 34 | "Current Editor Mode: {0}": "Current Editor Mode: {0}", 35 | "Choose the editor mode...": "Choose the editor mode...", 36 | "Input contains invalid characters or words! ({0})": "Input contains invalid characters or words! ({0})", 37 | "An editor section already exists with the given input!": "An editor section already exists with the given input!", 38 | "RGSS Script Editor: Set Project Folder": "RGSS Script Editor: Set Project Folder", 39 | "Choose RPG Maker Project Folder": "Choose RPG Maker Project Folder", 40 | "Choose a RPG Maker project folder from the current workspace to activate it": "Choose a RPG Maker project folder from the current workspace to activate it", 41 | "RGSS Script Editor: Active Project Folder": "RGSS Script Editor: Active Project Folder", 42 | "RPG Maker Active Project: {0}": "RPG Maker Active Project: {0}", 43 | "Opens the current active RPG Maker project folder": "Opens the current active RPG Maker project folder", 44 | "RGSS Script Editor: Run Game": "RGSS Script Editor: Run Game", 45 | "Run Game": "Run Game", 46 | "Runs the game executable": "Runs the game executable", 47 | "RGSS Script Editor: Extract Scripts": "RGSS Script Editor: Extract Scripts", 48 | "Extract Scripts": "Extract Scripts", 49 | "Extracts all scripts from the bundled RPG Maker scripts file": "Extracts all scripts from the bundled RPG Maker scripts file" 50 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "icon": "./icons/icon.png", 3 | "name": "rgss-script-editor", 4 | "displayName": "RGSS Script Editor", 5 | "description": "An extension that allows to use Visual Studio Code as the code editor for RPG Maker game projects", 6 | "author": { 7 | "name": "SnowSzn", 8 | "url": "https://github.com/SnowSzn" 9 | }, 10 | "publisher": "SnowSzn", 11 | "license": "GPL-3.0-only", 12 | "keywords": [ 13 | "Ruby Game Scripting System", 14 | "RGSS", 15 | "RGSS1", 16 | "RGSS2", 17 | "RGSS3", 18 | "RPGMaker", 19 | "RPG Maker Script Editor", 20 | "RPG Maker Script Extractor", 21 | "RPG Maker", 22 | "RPG Maker XP", 23 | "RPG Maker VX", 24 | "RPG Maker VX Ace" 25 | ], 26 | "repository": { 27 | "url": "https://github.com/SnowSzn/rgss-script-editor" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/SnowSzn/rgss-script-editor/issues" 31 | }, 32 | "version": "1.5.5", 33 | "engines": { 34 | "vscode": "^1.84.0" 35 | }, 36 | "categories": [ 37 | "Other" 38 | ], 39 | "activationEvents": [ 40 | "workspaceContains:Game.ini" 41 | ], 42 | "l10n": "./l10n", 43 | "main": "./out/extension.js", 44 | "contributes": { 45 | "commands": [ 46 | { 47 | "command": "rgss-script-editor.setProjectFolder", 48 | "title": "%command.setProjectFolder.title%", 49 | "category": "RGSS Script Editor", 50 | "icon": "$(folder)" 51 | }, 52 | { 53 | "command": "rgss-script-editor.openProjectFolder", 54 | "title": "%command.openProjectFolder.title%", 55 | "category": "RGSS Script Editor", 56 | "icon": "$(folder-opened)" 57 | }, 58 | { 59 | "command": "rgss-script-editor.extractScripts", 60 | "title": "%command.extractScripts.title%", 61 | "category": "RGSS Script Editor", 62 | "icon": "$(arrow-down)" 63 | }, 64 | { 65 | "command": "rgss-script-editor.importScripts", 66 | "title": "%command.importScripts.title%", 67 | "category": "RGSS Script Editor", 68 | "icon": "$(file-add)" 69 | }, 70 | { 71 | "command": "rgss-script-editor.createScriptLoader", 72 | "title": "%command.createScriptLoader.title%", 73 | "category": "RGSS Script Editor", 74 | "icon": "$(note)" 75 | }, 76 | { 77 | "command": "rgss-script-editor.createBackupBundleFile", 78 | "title": "%command.createBackupBundleFile.title%", 79 | "category": "RGSS Script Editor", 80 | "icon": "$(archive)" 81 | }, 82 | { 83 | "command": "rgss-script-editor.createBackupLoadOrder", 84 | "title": "%command.createBackupLoadOrder.title%", 85 | "category": "RGSS Script Editor", 86 | "icon": "$(archive)" 87 | }, 88 | { 89 | "command": "rgss-script-editor.createBundleFile", 90 | "title": "%command.createBundleFile.title%", 91 | "category": "RGSS Script Editor", 92 | "icon": "$(package)" 93 | }, 94 | { 95 | "command": "rgss-script-editor.createSelectedBundleFile", 96 | "title": "%command.createSelectedBundleFile.title%", 97 | "category": "RGSS Script Editor", 98 | "icon": "$(package)" 99 | }, 100 | { 101 | "command": "rgss-script-editor.compileBundleFile", 102 | "title": "%command.compileBundleFile.title%", 103 | "category": "RGSS Script Editor", 104 | "icon": "$(package)" 105 | }, 106 | { 107 | "command": "rgss-script-editor.runGame", 108 | "title": "%command.runGame.title%", 109 | "category": "RGSS Script Editor", 110 | "icon": "$(run)" 111 | }, 112 | { 113 | "command": "rgss-script-editor.processGameException", 114 | "title": "%command.processGameException.title%", 115 | "category": "RGSS Script Editor", 116 | "icon": "$(warning)" 117 | }, 118 | { 119 | "command": "rgss-script-editor.chooseEditorMode", 120 | "title": "%command.chooseEditorMode.title%", 121 | "category": "RGSS Script Editor", 122 | "icon": "$(insert)" 123 | }, 124 | { 125 | "command": "rgss-script-editor.openLoadOrder", 126 | "title": "%command.openLoadOrder.title%", 127 | "category": "RGSS Script Editor", 128 | "icon": "$(tasklist)" 129 | }, 130 | { 131 | "command": "rgss-script-editor.sectionCreate", 132 | "title": "%command.sectionCreate.title%", 133 | "category": "RGSS Script Editor", 134 | "icon": "$(new-file)" 135 | }, 136 | { 137 | "command": "rgss-script-editor.sectionDelete", 138 | "title": "%command.sectionDelete.title%", 139 | "category": "RGSS Script Editor", 140 | "icon": "$(trash)" 141 | }, 142 | { 143 | "command": "rgss-script-editor.sectionRename", 144 | "title": "%command.sectionRename.title%", 145 | "category": "RGSS Script Editor", 146 | "icon": "$(edit)" 147 | }, 148 | { 149 | "command": "rgss-script-editor.sectionMove", 150 | "title": "%command.sectionMove.title%", 151 | "category": "RGSS Script Editor", 152 | "icon": "$(move)" 153 | }, 154 | { 155 | "command": "rgss-script-editor.sectionCut", 156 | "title": "%command.sectionCut.title%", 157 | "category": "RGSS Script Editor", 158 | "icon": "$(clippy)" 159 | }, 160 | { 161 | "command": "rgss-script-editor.sectionCopy", 162 | "title": "%command.sectionCopy.title%", 163 | "category": "RGSS Script Editor", 164 | "icon": "$(clippy)" 165 | }, 166 | { 167 | "command": "rgss-script-editor.sectionPaste", 168 | "title": "%command.sectionPaste.title%", 169 | "category": "RGSS Script Editor", 170 | "icon": "$(clippy)" 171 | }, 172 | { 173 | "command": "rgss-script-editor.sectionToggleLoad", 174 | "title": "%command.sectionToggleLoad.title%", 175 | "category": "RGSS Script Editor", 176 | "icon": "$(arrow-swap)" 177 | }, 178 | { 179 | "command": "rgss-script-editor.sectionToggleCollapse", 180 | "title": "%command.sectionToggleCollapse.title%", 181 | "category": "RGSS Script Editor", 182 | "icon": "$(arrow-both)" 183 | }, 184 | { 185 | "command": "rgss-script-editor.sectionRevealInVSCodeExplorer", 186 | "title": "%command.sectionRevealInVSCodeExplorer.title%", 187 | "category": "RGSS Script Editor", 188 | "icon": "$(eye)" 189 | }, 190 | { 191 | "command": "rgss-script-editor.sectionOpenInExplorer", 192 | "title": "%command.sectionOpenInExplorer.title%", 193 | "category": "RGSS Script Editor", 194 | "icon": "$(search)" 195 | }, 196 | { 197 | "command": "rgss-script-editor.sectionCopyAbsolutePath", 198 | "title": "%command.sectionCopyAbsolutePath.title%", 199 | "category": "RGSS Script Editor", 200 | "icon": "$(copy)" 201 | }, 202 | { 203 | "command": "rgss-script-editor.sectionCopyRelativePath", 204 | "title": "%command.sectionCopyRelativePath.title%", 205 | "category": "RGSS Script Editor", 206 | "icon": "$(copy)" 207 | } 208 | ], 209 | "configuration": [ 210 | { 211 | "title": "RGSS Script Editor", 212 | "properties": { 213 | "rgssScriptEditor.debug.logToConsole": { 214 | "type": "boolean", 215 | "default": true, 216 | "description": "%configuration.debug.logToConsole.description%", 217 | "order": 0 218 | }, 219 | "rgssScriptEditor.debug.logToFile": { 220 | "type": "boolean", 221 | "default": false, 222 | "description": "%configuration.debug.logToFile.description%", 223 | "order": 1 224 | }, 225 | "rgssScriptEditor.extension.quickStart": { 226 | "type": "boolean", 227 | "default": true, 228 | "description": "%configuration.extension.quickStart.description%", 229 | "order": 10 230 | }, 231 | "rgssScriptEditor.extension.autoReveal": { 232 | "type": "boolean", 233 | "default": true, 234 | "description": "%configuration.extension.autoReveal.description%", 235 | "order": 11 236 | }, 237 | "rgssScriptEditor.extension.filesEndOfLine": { 238 | "type": "string", 239 | "enum": [ 240 | "auto", 241 | "\r\n", 242 | "\n" 243 | ], 244 | "enumDescriptions": [ 245 | "%configuration.extension.filesEndOfLine.enumDescriptionAuto%", 246 | "%configuration.extension.filesEndOfLine.enumDescriptionCRLF%", 247 | "%configuration.extension.filesEndOfLine.enumDescriptionLF%" 248 | ], 249 | "default": "auto", 250 | "description": "%configuration.extension.filesEndOfLine.description%", 251 | "order": 12 252 | }, 253 | "rgssScriptEditor.extension.insertEncodingComment": { 254 | "type": "boolean", 255 | "default": false, 256 | "description": "%configuration.extension.insertEncodingComment.description%", 257 | "order": 13 258 | }, 259 | "rgssScriptEditor.extension.recreateScriptLoader": { 260 | "type": "boolean", 261 | "default": true, 262 | "description": "%configuration.extension.recreateScriptLoader.description%", 263 | "order": 14 264 | }, 265 | "rgssScriptEditor.extension.scriptNameValidation": { 266 | "type": "string", 267 | "enum": [ 268 | "auto", 269 | "always", 270 | "never" 271 | ], 272 | "enumDescriptions": [ 273 | "%configuration.extension.scriptNameValidation.enumDescriptionAuto%", 274 | "%configuration.extension.scriptNameValidation.enumDescriptionAlways%", 275 | "%configuration.extension.scriptNameValidation.enumDescriptionNever%" 276 | ], 277 | "default": "auto", 278 | "description": "%configuration.extension.scriptNameValidation.description%", 279 | "order": 18 280 | }, 281 | "rgssScriptEditor.external.backUpsFolder": { 282 | "type": "string", 283 | "default": "./.rgss-script-editor/backups", 284 | "description": "%configuration.external.backUpsFolder.description%", 285 | "order": 30 286 | }, 287 | "rgssScriptEditor.external.loadOrderBackUpsFolder": { 288 | "type": "string", 289 | "default": "./.rgss-script-editor/backups/load orders", 290 | "description": "%configuration.external.loadOrderBackUpsFolder.description%", 291 | "order": 32 292 | }, 293 | "rgssScriptEditor.external.scriptsFolder": { 294 | "type": "string", 295 | "default": "./Scripts", 296 | "description": "%configuration.external.scriptsFolder.description%", 297 | "order": 35 298 | }, 299 | "rgssScriptEditor.external.extensionLogFileFolder": { 300 | "type": "string", 301 | "default": "./.rgss-script-editor", 302 | "description": "%configuration.external.extensionLogFileFolder.description%", 303 | "order": 40 304 | }, 305 | "rgssScriptEditor.external.gameLogFileFolder": { 306 | "type": "string", 307 | "default": "./.rgss-script-editor", 308 | "description": "%configuration.external.gameLogFileFolder.description%", 309 | "order": 41 310 | }, 311 | "rgssScriptEditor.external.scriptsCompileFolder": { 312 | "type": "string", 313 | "default": "./.rgss-script-editor/dist", 314 | "description": "%configuration.external.scriptsCompileFolder.description%", 315 | "order": 45 316 | }, 317 | "rgssScriptEditor.gameplay.gameExecutablePath": { 318 | "type": "string", 319 | "default": "./Game.exe", 320 | "description": "%configuration.gameplay.gameExecutablePath.description%", 321 | "order": 50 322 | }, 323 | "rgssScriptEditor.gameplay.useWine": { 324 | "type": "string", 325 | "default": "wine", 326 | "description": "%configuration.gameplay.useWine.description%", 327 | "order": 51 328 | }, 329 | "rgssScriptEditor.gameplay.runGameBehavior": { 330 | "type": "string", 331 | "enum": [ 332 | "nothing", 333 | "kill and run", 334 | "allow multiple" 335 | ], 336 | "enumDescriptions": [ 337 | "%configuration.gameplay.runGameBehavior.enumDescriptionNothing%", 338 | "%configuration.gameplay.runGameBehavior.enumDescriptionKillAndRun%", 339 | "%configuration.gameplay.runGameBehavior.enumDescriptionAllowMultiple%" 340 | ], 341 | "default": "nothing", 342 | "description": "%configuration.gameplay.runGameBehavior.description%", 343 | "order": 55 344 | }, 345 | "rgssScriptEditor.gameplay.automaticArgumentsDetection": { 346 | "type": "boolean", 347 | "default": true, 348 | "description": "%configuration.gameplay.automaticArgumentsDetection.description%", 349 | "order": 60 350 | }, 351 | "rgssScriptEditor.gameplay.editorTestMode": { 352 | "type": "boolean", 353 | "default": true, 354 | "description": "%configuration.gameplay.editorTestMode.description%", 355 | "order": 61 356 | }, 357 | "rgssScriptEditor.gameplay.nativeConsole": { 358 | "type": "boolean", 359 | "default": true, 360 | "description": "%configuration.gameplay.nativeConsole.description%", 361 | "order": 62 362 | }, 363 | "rgssScriptEditor.gameplay.customArguments": { 364 | "type": "string", 365 | "default": "", 366 | "description": "%configuration.gameplay.customArguments.description%", 367 | "order": 63 368 | }, 369 | "rgssScriptEditor.gameplay.gameExceptionAutoProcess": { 370 | "type": "boolean", 371 | "default": false, 372 | "description": "%configuration.gameplay.gameExceptionAutoProcess.description%", 373 | "order": 70 374 | }, 375 | "rgssScriptEditor.gameplay.gameExceptionShowInEditor": { 376 | "type": "boolean", 377 | "default": true, 378 | "description": "%configuration.gameplay.gameExceptionShowInEditor.description%", 379 | "order": 71 380 | } 381 | } 382 | } 383 | ], 384 | "keybindings": [ 385 | { 386 | "command": "rgss-script-editor.setProjectFolder", 387 | "key": "F6", 388 | "when": "workspaceFolderCount > 0" 389 | }, 390 | { 391 | "command": "rgss-script-editor.runGame", 392 | "key": "F12", 393 | "when": "rgss-script-editor.openedFolder" 394 | }, 395 | { 396 | "command": "rgss-script-editor.compileBundleFile", 397 | "key": "CTRL+F5", 398 | "when": "rgss-script-editor.extractedScripts" 399 | }, 400 | { 401 | "command": "rgss-script-editor.sectionCreate", 402 | "key": "insert", 403 | "when": "focusedView == 'rgss-script-editor.editorView'" 404 | }, 405 | { 406 | "command": "rgss-script-editor.sectionDelete", 407 | "key": "delete", 408 | "when": "focusedView == 'rgss-script-editor.editorView'" 409 | }, 410 | { 411 | "command": "rgss-script-editor.sectionRename", 412 | "key": "F2", 413 | "when": "focusedView == 'rgss-script-editor.editorView'" 414 | }, 415 | { 416 | "command": "rgss-script-editor.sectionCut", 417 | "key": "CTRL+X", 418 | "when": "focusedView == 'rgss-script-editor.editorView'" 419 | }, 420 | { 421 | "command": "rgss-script-editor.sectionCopy", 422 | "key": "CTRL+C", 423 | "when": "focusedView == 'rgss-script-editor.editorView'" 424 | }, 425 | { 426 | "command": "rgss-script-editor.sectionPaste", 427 | "key": "CTRL+V", 428 | "when": "focusedView == 'rgss-script-editor.editorView'" 429 | }, 430 | { 431 | "command": "rgss-script-editor.sectionToggleLoad", 432 | "key": "F4", 433 | "when": "focusedView == 'rgss-script-editor.editorView'" 434 | }, 435 | { 436 | "command": "rgss-script-editor.sectionCopyAbsolutePath", 437 | "key": "F7", 438 | "when": "focusedView == 'rgss-script-editor.editorView'" 439 | }, 440 | { 441 | "command": "rgss-script-editor.sectionCopyRelativePath", 442 | "key": "F8", 443 | "when": "focusedView == 'rgss-script-editor.editorView'" 444 | } 445 | ], 446 | "viewsContainers": { 447 | "activitybar": [ 448 | { 449 | "id": "rgss-script-editor", 450 | "icon": "./icons/views/icon.svg", 451 | "title": "RGSS Script Editor" 452 | } 453 | ] 454 | }, 455 | "views": { 456 | "rgss-script-editor": [ 457 | { 458 | "id": "rgss-script-editor.editorView", 459 | "icon": "./icons/views/icon.svg", 460 | "contextualTitle": "RGSS Script Editor", 461 | "name": "Editor" 462 | } 463 | ] 464 | }, 465 | "viewsWelcome": [ 466 | { 467 | "view": "rgss-script-editor.editorView", 468 | "contents": "%viewsWelcome.contents1%", 469 | "when": "workspaceFolderCount <= 0" 470 | }, 471 | { 472 | "view": "rgss-script-editor.editorView", 473 | "contents": "%viewsWelcome.contents2%", 474 | "when": "workspaceFolderCount == 1 && !rgss-script-editor.openedFolder" 475 | }, 476 | { 477 | "view": "rgss-script-editor.editorView", 478 | "contents": "%viewsWelcome.contents3%", 479 | "when": "workspaceFolderCount > 1 && !rgss-script-editor.openedFolder" 480 | }, 481 | { 482 | "view": "rgss-script-editor.editorView", 483 | "contents": "%viewsWelcome.contents4%", 484 | "when": "rgss-script-editor.openedFolder && !rgss-script-editor.extractedScripts" 485 | } 486 | ], 487 | "menus": { 488 | "view/title": [ 489 | { 490 | "command": "rgss-script-editor.chooseEditorMode", 491 | "when": "view == rgss-script-editor.editorView", 492 | "group": "navigation" 493 | }, 494 | { 495 | "command": "rgss-script-editor.openLoadOrder", 496 | "when": "view == rgss-script-editor.editorView", 497 | "group": "navigation" 498 | }, 499 | { 500 | "command": "rgss-script-editor.sectionCreate", 501 | "when": "view == rgss-script-editor.editorView", 502 | "group": "1" 503 | }, 504 | { 505 | "command": "rgss-script-editor.processGameException", 506 | "when": "view == rgss-script-editor.editorView", 507 | "group": "2" 508 | }, 509 | { 510 | "command": "rgss-script-editor.createScriptLoader", 511 | "when": "view == rgss-script-editor.editorView", 512 | "group": "3" 513 | }, 514 | { 515 | "command": "rgss-script-editor.createBundleFile", 516 | "when": "view == rgss-script-editor.editorView", 517 | "group": "4" 518 | }, 519 | { 520 | "command": "rgss-script-editor.createBackupBundleFile", 521 | "when": "view == rgss-script-editor.editorView", 522 | "group": "4" 523 | }, 524 | { 525 | "command": "rgss-script-editor.createBackupLoadOrder", 526 | "when": "view == rgss-script-editor.editorView", 527 | "group": "4" 528 | }, 529 | { 530 | "command": "rgss-script-editor.createSelectedBundleFile", 531 | "when": "view == rgss-script-editor.editorView", 532 | "group": "4" 533 | }, 534 | { 535 | "command": "rgss-script-editor.importScripts", 536 | "when": "view == rgss-script-editor.editorView", 537 | "group": "5" 538 | } 539 | ], 540 | "view/item/context": [ 541 | { 542 | "command": "rgss-script-editor.sectionRename", 543 | "when": "view == rgss-script-editor.editorView", 544 | "group": "1" 545 | }, 546 | { 547 | "command": "rgss-script-editor.sectionToggleLoad", 548 | "when": "view == rgss-script-editor.editorView", 549 | "group": "2" 550 | }, 551 | { 552 | "command": "rgss-script-editor.sectionCreate", 553 | "when": "view == rgss-script-editor.editorView", 554 | "group": "3" 555 | }, 556 | { 557 | "command": "rgss-script-editor.sectionDelete", 558 | "when": "view == rgss-script-editor.editorView", 559 | "group": "3" 560 | }, 561 | { 562 | "command": "rgss-script-editor.sectionCut", 563 | "when": "view == rgss-script-editor.editorView", 564 | "group": "4" 565 | }, 566 | { 567 | "command": "rgss-script-editor.sectionCopy", 568 | "when": "view == rgss-script-editor.editorView", 569 | "group": "4" 570 | }, 571 | { 572 | "command": "rgss-script-editor.sectionPaste", 573 | "when": "view == rgss-script-editor.editorView", 574 | "group": "4" 575 | }, 576 | { 577 | "command": "rgss-script-editor.sectionCopyAbsolutePath", 578 | "when": "view == rgss-script-editor.editorView", 579 | "group": "6" 580 | }, 581 | { 582 | "command": "rgss-script-editor.sectionCopyRelativePath", 583 | "when": "view == rgss-script-editor.editorView", 584 | "group": "6" 585 | }, 586 | { 587 | "command": "rgss-script-editor.sectionRevealInVSCodeExplorer", 588 | "when": "view == rgss-script-editor.editorView", 589 | "group": "7" 590 | }, 591 | { 592 | "command": "rgss-script-editor.sectionOpenInExplorer", 593 | "when": "view == rgss-script-editor.editorView", 594 | "group": "7" 595 | }, 596 | { 597 | "command": "rgss-script-editor.createSelectedBundleFile", 598 | "when": "view == rgss-script-editor.editorView", 599 | "group": "8" 600 | } 601 | ] 602 | } 603 | }, 604 | "scripts": { 605 | "vscode:prepublish": "yarn run compile", 606 | "compile": "tsc -p ./", 607 | "watch": "tsc -watch -p ./", 608 | "pretest": "yarn run compile && yarn run lint", 609 | "lint": "eslint src --ext ts", 610 | "test": "node ./out/test/runTest.js", 611 | "generate-package": "vsce package --out ./dist", 612 | "l10n-gen": "npx @vscode/l10n-dev export --outDir ./l10n ./src" 613 | }, 614 | "dependencies": { 615 | "@hyrious/marshal": "^0.3.2" 616 | }, 617 | "devDependencies": { 618 | "@types/mocha": "^10.0.3", 619 | "@types/node": "^22.15.18", 620 | "@types/vscode": "^1.84.0", 621 | "@typescript-eslint/eslint-plugin": "^8.32.1", 622 | "@typescript-eslint/parser": "^8.32.1", 623 | "@vscode/l10n-dev": "^0.0.35", 624 | "@vscode/test-electron": "^2.3.6", 625 | "eslint": "^9.26.0", 626 | "glob": "^11.0.2", 627 | "mocha": "^11.2.2", 628 | "typescript": "^5.2.2" 629 | } 630 | } -------------------------------------------------------------------------------- /package.nls.es.json: -------------------------------------------------------------------------------- 1 | { 2 | "command.setProjectFolder.title": "Establecer carpeta del proyecto", 3 | "command.openProjectFolder.title": "Abrir carpeta del proyecto", 4 | "command.extractScripts.title": "Extraer scripts", 5 | "command.importScripts.title": "Importar scripts desde fichero compilado", 6 | "command.createScriptLoader.title": "Crear cargador de scripts", 7 | "command.createBackupBundleFile.title": "Crear una copia de seguridad con todas las secciones", 8 | "command.createBackupLoadOrder.title": "Crear una copia de seguridad del orden de carga", 9 | "command.createBundleFile.title": "Crear un fichero compilado con las secciones habilitadas", 10 | "command.createSelectedBundleFile.title": "Crear un fichero compilado con las secciones seleccionadas", 11 | "command.compileBundleFile.title": "Compilar scripts habilitados", 12 | "command.runGame.title": "Ejecutar juego", 13 | "command.processGameException.title": "Ver última excepción del juego", 14 | "command.chooseEditorMode.title": "Elegir modo de editor", 15 | "command.openLoadOrder.title": "Abrir fichero de orden de carga", 16 | "command.sectionCreate.title": "Crear sección...", 17 | "command.sectionDelete.title": "Eliminar sección/es...", 18 | "command.sectionRename.title": "Renombrar sección...", 19 | "command.sectionMove.title": "Mover sección...", 20 | "command.sectionCut.title": "Cortar sección/es...", 21 | "command.sectionCopy.title": "Copiar sección/es...", 22 | "command.sectionPaste.title": "Pegar sección/es...", 23 | "command.sectionToggleLoad.title": "Alternar estado de carga de sección/es...", 24 | "command.sectionToggleCollapse.title": "Alternar estado de colapso de sección...", 25 | "command.sectionRevealInVSCodeExplorer.title": "Mostrar en el explorador...", 26 | "command.sectionOpenInExplorer.title": "Mostrar en el explorador de archivos...", 27 | "command.sectionCopyAbsolutePath.title": "Copiar ruta absoluta...", 28 | "command.sectionCopyRelativePath.title": "Copiar ruta relativa...", 29 | "configuration.debug.logToConsole.description": "Permite que esta extensión registre información en un canal de salida de VSCode.", 30 | "configuration.debug.logToFile.description": "Permite que esta extensión registre información en un archivo log dentro de la carpeta del proyecto.", 31 | "configuration.extension.quickStart.description": "Habilita el modo de inicio rápido.\n\nCuando está habilitado, la extensión abrirá automáticamente la carpeta actual si es un proyecto válido de RPG Maker.", 32 | "configuration.extension.autoReveal.description": "Permite que la extensión muestre el archivo de script activo en la vista del editor de scripts.", 33 | "configuration.extension.filesEndOfLine.enumDescriptionAuto": "El modo automático usa el tipo de fin de línea apropiado según el sistema operativo", 34 | "configuration.extension.filesEndOfLine.enumDescriptionCRLF": "CRLF", 35 | "configuration.extension.filesEndOfLine.enumDescriptionLF": "LF", 36 | "configuration.extension.filesEndOfLine.description": "Elige el tipo de fin de línea que la extensión usará para los archivos.", 37 | "configuration.extension.insertEncodingComment.description": "Permite que la extensión inserte un comentario mágico (# encoding: utf-8) en cada archivo de script de Ruby.\n\nEn versiones anteriores era obligatorio, ya que Ruby no podía determinar la codificación del archivo.\n\nYa no es necesario desde la versión 1.5.0, pero queda disponible como opción del usuario.\n\nPuedes leer más en el README de la extensión.", 38 | "configuration.extension.recreateScriptLoader.description": "Indica si se debe recrear el cargador de scripts al abrir un proyecto.\n\nEste \"loader\" puede cambiar entre versiones, así que se recomienda dejarlo habilitado.\n\nDesactívalo solo si estás usando un script personalizado o quieres actualizarlo manualmente.", 39 | "configuration.extension.scriptNameValidation.enumDescriptionAuto": "Modo automático activa/desactiva la validación cuando sea necesario", 40 | "configuration.extension.scriptNameValidation.enumDescriptionAlways": "Validar siempre los nombres de los scripts (habilitado)", 41 | "configuration.extension.scriptNameValidation.enumDescriptionNever": "Nunca validar los nombres de los scripts (deshabilitado)", 42 | "configuration.extension.scriptNameValidation.description": "Elige el modo de validación de nombres de scripts.\n\nPor una limitación de Ruby, cualquier versión de RPG Maker que use una versión de Ruby inferior a la 1.9 debe habilitar esta opción.\n\nAfecta a RPG Maker XP y RPG Maker VX.\n\nSi usas MKXP-Z no necesitas esto.\n\nConsulta el README de la extensión para más detalles.\n\n**DESACTIVAR BAJO TU PROPIO RIESGO**", 43 | "configuration.external.backUpsFolder.description": "Ruta relativa dentro del proyecto donde se guardarán las copias de seguridad de los ficheros de scripts de RPG Maker.", 44 | "configuration.external.loadOrderBackUpsFolder.description": "Ruta relativa dentro del proyecto donde se guardarán las copias de seguridad del orden de carga.", 45 | "configuration.external.scriptsFolder.description": "Ruta relativa dentro del proyecto donde se extraerán todos los scripts.", 46 | "configuration.external.extensionLogFileFolder.description": "Ruta relativa dentro del proyecto donde se creará el fichero log de la extensión.", 47 | "configuration.external.gameLogFileFolder.description": "Ruta relativa dentro del proyecto donde se creará el fichero log del juego.", 48 | "configuration.external.scriptsCompileFolder.description": "Ruta relativa dentro del proyecto donde se guardará el archivo compilado de scripts.", 49 | "configuration.gameplay.gameExecutablePath.description": "Ruta relativa al ejecutable del juego dentro del proyecto.", 50 | "configuration.gameplay.useWine.description": "Establece el comando para invocar Wine y ejecutar el juego. (¡Solo Linux!)", 51 | "configuration.gameplay.runGameBehavior.enumDescriptionNothing": "Comportamiento por defecto de RPG Maker (debes cerrar el juego antes de ejecutarlo de nuevo)", 52 | "configuration.gameplay.runGameBehavior.enumDescriptionKillAndRun": "Finaliza el ejecutable del juego y lo ejecuta de nuevo automáticamente", 53 | "configuration.gameplay.runGameBehavior.enumDescriptionAllowMultiple": "Permite múltiples instancias del juego ejecutándose a la vez", 54 | "configuration.gameplay.runGameBehavior.description": "Elige cómo manejar el ejecutable del juego cuando ya está en ejecución.", 55 | "configuration.gameplay.automaticArgumentsDetection.description": "Habilita la detección automática de argumentos.\n\nSi está habilitada, la extensión elegirá los argumentos adecuados según la versión de RPG Maker detectada.", 56 | "configuration.gameplay.editorTestMode.description": "Habilita el modo de prueba (debug)", 57 | "configuration.gameplay.nativeConsole.description": "Habilita la consola nativa de RPG Maker. (¡Solo RPG Maker VX Ace!)", 58 | "configuration.gameplay.customArguments.description": "Define tus propios argumentos separados por espacios.\n\n¡Debes desactivar la detección automática para usar esto!", 59 | "configuration.gameplay.gameExceptionAutoProcess.description": "Permite que la extensión procese automáticamente la última excepción detectada.", 60 | "configuration.gameplay.gameExceptionShowInEditor.description": "Permite que la extensión muestre un archivo markdown junto al editor activo con la traza de la excepción.", 61 | "viewsWelcome.contents1": "No hay ninguna carpeta abierta en Visual Studio Code.\nDebes abrir una carpeta de un proyecto de RPG Maker para comenzar a usar esta extensión.\n[Abrir carpeta](command:vscode.openFolder)", 62 | "viewsWelcome.contents2": "Se ha detectado una carpeta abierta.\nPuedes seleccionarla como carpeta activa del proyecto RPG Maker usando el botón de abajo.\n[Establecer carpeta del proyecto](command:rgss-script-editor.setProjectFolder)", 63 | "viewsWelcome.contents3": "Hay más de una carpeta abierta en Visual Studio Code.\nPuedes seleccionar una carpeta como proyecto activo de RPG Maker usando el botón de abajo.\n[Establecer carpeta del proyecto](command:rgss-script-editor.setProjectFolder)", 64 | "viewsWelcome.contents4": "Para usar esta extensión debes extraer el contenido del archivo empaquetado de RPG Maker.\nSe creará una nueva carpeta con todos los scripts extraídos dentro de la carpeta del proyecto.\nUna vez extraídos, puedes comenzar a usar el editor.\n[Extraer scripts](command:rgss-script-editor.extractScripts)" 65 | } -------------------------------------------------------------------------------- /package.nls.json: -------------------------------------------------------------------------------- 1 | { 2 | "command.setProjectFolder.title": "Set Project Folder", 3 | "command.openProjectFolder.title": "Open Project Folder", 4 | "command.extractScripts.title": "Extract Scripts", 5 | "command.importScripts.title": "Import Scripts From Bundle File", 6 | "command.createScriptLoader.title": "Create Script Loader", 7 | "command.createBackupBundleFile.title": "Create a Back Up With All Sections", 8 | "command.createBackupLoadOrder.title": "Create a Back Up of the Load Order", 9 | "command.createBundleFile.title": "Create a Bundle File With Enabled Sections", 10 | "command.createSelectedBundleFile.title": "Create a Bundle File With Selected Sections", 11 | "command.compileBundleFile.title": "Compile Enabled Scripts", 12 | "command.runGame.title": "Run Game", 13 | "command.processGameException.title": "Check Last Game Exception", 14 | "command.chooseEditorMode.title": "Choose Editor Mode", 15 | "command.openLoadOrder.title": "Open Load Order File", 16 | "command.sectionCreate.title": "Create Section...", 17 | "command.sectionDelete.title": "Delete Section/s...", 18 | "command.sectionRename.title": "Rename Section...", 19 | "command.sectionMove.title": "Move Section...", 20 | "command.sectionCut.title": "Cut Section/s...", 21 | "command.sectionCopy.title": "Copy Section/s...", 22 | "command.sectionPaste.title": "Paste Section/s...", 23 | "command.sectionToggleLoad.title": "Toggle Section/s Load Status On/Off...", 24 | "command.sectionToggleCollapse.title": "Toggle Section Collapse Status...", 25 | "command.sectionRevealInVSCodeExplorer.title": "Reveal in Explorer...", 26 | "command.sectionOpenInExplorer.title": "Reveal In File Explorer...", 27 | "command.sectionCopyAbsolutePath.title": "Copy Absolute Path...", 28 | "command.sectionCopyRelativePath.title": "Copy Relative Path...", 29 | "configuration.debug.logToConsole.description": "Enables this extension to log information to a VSCode output channel.", 30 | "configuration.debug.logToFile.description": "Enables this extension to log information to a file inside the project's folder.", 31 | "configuration.extension.quickStart.description": "Enables quick start mode.\n\nWhen quick start mode is enabled, the extension will open the current folder automatically if it is a valid RPG Maker project.", 32 | "configuration.extension.autoReveal.description": "Allows the extension to reveal the active script file on the extension's script editor view.", 33 | "configuration.extension.filesEndOfLine.enumDescriptionAuto": "Auto mode uses the appropiate EOL type based on the operating system", 34 | "configuration.extension.filesEndOfLine.enumDescriptionCRLF": "CRLF", 35 | "configuration.extension.filesEndOfLine.enumDescriptionLF": "LF", 36 | "configuration.extension.filesEndOfLine.description": "Choose the type of end of line that the extension will use for files.", 37 | "configuration.extension.insertEncodingComment.description": "Allows the extension to insert a magic comment (# encoding: utf-8) inside every Ruby script file.\n\nIn older versions of the extension, all scripts must have this magic comment because Ruby was not able to determine the encoding of a file.\n\nThis is not needed anymore since v1.5.0 but it is available at the user's choice.\n\nYou can read more in the extension's README.", 38 | "configuration.extension.recreateScriptLoader.description": "Whether to re-create the script loader when a project is opened or not.\n\nThe script loader this extension uses is subject to change between updates so it is recommended to leave it enabled.\n\nOnly disable this if you are using a custom script loader or you want to update the script loader manually between updates.", 39 | "configuration.extension.scriptNameValidation.enumDescriptionAuto": "Auto mode enables/disables script name validation when necessary", 40 | "configuration.extension.scriptNameValidation.enumDescriptionAlways": "Always validate script names (enabled)", 41 | "configuration.extension.scriptNameValidation.enumDescriptionNever": "Never validate script names (disabled)", 42 | "configuration.extension.scriptNameValidation.description": "Choose script name validation mode.\n\nDue to a Ruby limitation, any RPG Maker that uses a version of Ruby below v1.9 must enable this setting.\n\nThe RPG Maker versions affected by this limitation are: RPG Maker XP and RPG Maker VX.\n\nIf you are using MKXP-Z you don't need to use this, regardless of the RPG Maker version.\n\nCheck extension's README for more information.\n\n**DISABLE AT YOUR OWN RISK**", 43 | "configuration.external.backUpsFolder.description": "The relative path within the project's folder where all bundle scripts files backups will be saved.", 44 | "configuration.external.loadOrderBackUpsFolder.description": "The relative path within the project's folder where all bundle scripts files backups will be saved.", 45 | "configuration.external.scriptsFolder.description": "The relative path within the project's folder where all scripts will be extracted.", 46 | "configuration.external.extensionLogFileFolder.description": "The relative path within the project's folder where the extension log file is created.", 47 | "configuration.external.gameLogFileFolder.description": "The relative path within the project's folder where the game log file is created.", 48 | "configuration.external.scriptsCompileFolder.description": "The relative path within the project's folder where the compiled scripts bundle file is saved.", 49 | "configuration.gameplay.gameExecutablePath.description": "The relative path to the game executable inside the project folder.", 50 | "configuration.gameplay.useWine.description": "Sets the command to invoke Wine to run the game executable. (Linux Only!)", 51 | "configuration.gameplay.runGameBehavior.enumDescriptionNothing": "This is the default RPG Maker behavior (You need to close the game before running it again", 52 | "configuration.gameplay.runGameBehavior.enumDescriptionKillAndRun": "Kills the game executable and runs it again automatically", 53 | "configuration.gameplay.runGameBehavior.enumDescriptionAllowMultiple": "Allows multiple game processes running at the same time", 54 | "configuration.gameplay.runGameBehavior.description": "Choose how the game executable is handled when it is already running.", 55 | "configuration.gameplay.automaticArgumentsDetection.description": "Enables automatic arguments detection mode.\n\nIf enabled, the extension will automatically choose the appropiate arguments based on the RPG Maker version detected.", 56 | "configuration.gameplay.editorTestMode.description": "Enables test (debug) mode", 57 | "configuration.gameplay.nativeConsole.description": "Enables RPG Maker native console. (RPG Maker VX Ace only!)", 58 | "configuration.gameplay.customArguments.description": "Set your own custom arguments here separated by a whitespace.\n\nYou must disable 'auto. arguments detection' behavior to use this!", 59 | "configuration.gameplay.gameExceptionAutoProcess.description": "Allows the extension to auto-process the last detected exception.", 60 | "configuration.gameplay.gameExceptionShowInEditor.description": "Allows the extension to show a markdown file besides the active editor with the exception backtrace information.", 61 | "viewsWelcome.contents1": "There is no folder open in Visual Studio Code.\nYou should open a RPG Maker project folder to start this extension.\n[Open Folder](command:vscode.openFolder)", 62 | "viewsWelcome.contents2": "A folder is currently open.\nYou can select the folder to set it as the active RPG Maker folder using the button below.\n[Set Active Project Folder](command:rgss-script-editor.setProjectFolder)", 63 | "viewsWelcome.contents3": "There is more than one folder open in Visual Studio Code.\nYou can select a folder to set it as the active RPG Maker folder using the button below.\n[Set Active Project Folder](command:rgss-script-editor.setProjectFolder)", 64 | "viewsWelcome.contents4": "To use this extension you must extract the contents of the RPG Maker bundled file.\nA new folder with all script files extracted will be created inside the folder.\nOnce all scripts are extracted, you can start using this editor\n[Extract Scripts](command:rgss-script-editor.extractScripts)" 65 | } -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import * as manager from './modules/manager'; 3 | import * as strings from './modules/utils/strings'; 4 | 5 | /** 6 | * Entry point. 7 | * 8 | * This method is called when your extension is activated. 9 | * 10 | * Your extension is activated the very first time the command is executed. 11 | * @param context Extension context 12 | */ 13 | export function activate(context: vscode.ExtensionContext) { 14 | // ********************************************************** 15 | // Basic configuration 16 | // ********************************************************** 17 | 18 | // VSCode Configuration change event. 19 | context.subscriptions.push( 20 | vscode.workspace.onDidChangeConfiguration((event) => { 21 | manager.onDidChangeConfiguration(event); 22 | }) 23 | ); 24 | 25 | // VSCode Tree view update active file 26 | context.subscriptions.push( 27 | vscode.window.onDidChangeActiveTextEditor((editor) => { 28 | manager.updateTextEditor(editor); 29 | }) 30 | ); 31 | 32 | // ********************************************************** 33 | // User commands 34 | // ********************************************************** 35 | 36 | // Set project folder command 37 | context.subscriptions.push( 38 | vscode.commands.registerCommand( 39 | 'rgss-script-editor.setProjectFolder', 40 | () => { 41 | vscode.window 42 | .showWorkspaceFolderPick({ 43 | placeHolder: strings.SET_PROJECT_PLACEHOLDER, 44 | ignoreFocusOut: true, 45 | }) 46 | .then((value) => { 47 | if (value) { 48 | manager.setProjectFolder(value.uri); 49 | } 50 | }); 51 | } 52 | ) 53 | ); 54 | 55 | // Open project folder command 56 | context.subscriptions.push( 57 | vscode.commands.registerCommand( 58 | 'rgss-script-editor.openProjectFolder', 59 | () => { 60 | manager.openProjectFolder(); 61 | } 62 | ) 63 | ); 64 | 65 | // Extract scripts 66 | context.subscriptions.push( 67 | vscode.commands.registerCommand('rgss-script-editor.extractScripts', () => { 68 | manager.extractScripts(); 69 | }) 70 | ); 71 | 72 | // Import scripts 73 | context.subscriptions.push( 74 | vscode.commands.registerCommand('rgss-script-editor.importScripts', () => { 75 | manager.importScripts(); 76 | }) 77 | ); 78 | 79 | // Create script loader 80 | context.subscriptions.push( 81 | vscode.commands.registerCommand( 82 | 'rgss-script-editor.createScriptLoader', 83 | () => { 84 | manager.createScriptLoader(); 85 | } 86 | ) 87 | ); 88 | 89 | // Create a back up bundle file from extracted scripts 90 | context.subscriptions.push( 91 | vscode.commands.registerCommand( 92 | 'rgss-script-editor.createBackupBundleFile', 93 | () => { 94 | manager.createBackUpBundleFile(); 95 | } 96 | ) 97 | ); 98 | 99 | // Create a back up of the load order file 100 | context.subscriptions.push( 101 | vscode.commands.registerCommand( 102 | 'rgss-script-editor.createBackupLoadOrder', 103 | () => { 104 | manager.createBackUpLoadOrder(); 105 | } 106 | ) 107 | ); 108 | 109 | // Create bundle file from extracted scripts 110 | context.subscriptions.push( 111 | vscode.commands.registerCommand( 112 | 'rgss-script-editor.createBundleFile', 113 | () => { 114 | manager.createBundleFile(); 115 | } 116 | ) 117 | ); 118 | 119 | // Create bundle file from selected scripts 120 | context.subscriptions.push( 121 | vscode.commands.registerCommand( 122 | 'rgss-script-editor.createSelectedBundleFile', 123 | () => { 124 | manager.createSelectedBundleFile(); 125 | } 126 | ) 127 | ); 128 | 129 | // Compile bundle file from enabled scripts 130 | context.subscriptions.push( 131 | vscode.commands.registerCommand( 132 | 'rgss-script-editor.compileBundleFile', 133 | () => { 134 | manager.compileBundleFile(); 135 | } 136 | ) 137 | ); 138 | 139 | // Run game command 140 | context.subscriptions.push( 141 | vscode.commands.registerCommand('rgss-script-editor.runGame', () => { 142 | manager.runGame(); 143 | }) 144 | ); 145 | 146 | // Process game exception 147 | context.subscriptions.push( 148 | vscode.commands.registerCommand( 149 | 'rgss-script-editor.processGameException', 150 | () => { 151 | manager.processGameException(); 152 | } 153 | ) 154 | ); 155 | 156 | // Choose drop mode command 157 | context.subscriptions.push( 158 | vscode.commands.registerCommand( 159 | 'rgss-script-editor.chooseEditorMode', 160 | () => { 161 | manager.chooseEditorMode(); 162 | } 163 | ) 164 | ); 165 | 166 | // Open load order txt file. 167 | context.subscriptions.push( 168 | vscode.commands.registerCommand('rgss-script-editor.openLoadOrder', () => { 169 | manager.openLoadOrderFile(); 170 | }) 171 | ); 172 | 173 | // ********************************************************** 174 | // Extension commands (won't be used by the user) 175 | // ********************************************************** 176 | 177 | // Create script command 178 | context.subscriptions.push( 179 | vscode.commands.registerCommand( 180 | 'rgss-script-editor.sectionCreate', 181 | (what) => { 182 | manager.sectionCreate(what); 183 | } 184 | ) 185 | ); 186 | 187 | // Delete script command 188 | context.subscriptions.push( 189 | vscode.commands.registerCommand( 190 | 'rgss-script-editor.sectionDelete', 191 | (what) => { 192 | manager.sectionDelete(what); 193 | } 194 | ) 195 | ); 196 | 197 | // Rename script command 198 | context.subscriptions.push( 199 | vscode.commands.registerCommand( 200 | 'rgss-script-editor.sectionRename', 201 | (what) => { 202 | manager.sectionRename(what); 203 | } 204 | ) 205 | ); 206 | 207 | // Drag and drop handler command 208 | context.subscriptions.push( 209 | vscode.commands.registerCommand( 210 | 'rgss-script-editor.sectionMove', 211 | (...what: any[]) => { 212 | manager.sectionMove(...what); 213 | } 214 | ) 215 | ); 216 | 217 | // Cut handler command 218 | context.subscriptions.push( 219 | vscode.commands.registerCommand('rgss-script-editor.sectionCut', (what) => { 220 | manager.sectionCut(what); 221 | }) 222 | ); 223 | 224 | // Copy handler command 225 | context.subscriptions.push( 226 | vscode.commands.registerCommand( 227 | 'rgss-script-editor.sectionCopy', 228 | (what) => { 229 | manager.sectionCopy(what); 230 | } 231 | ) 232 | ); 233 | 234 | // Paste handler command 235 | context.subscriptions.push( 236 | vscode.commands.registerCommand( 237 | 'rgss-script-editor.sectionPaste', 238 | (what) => { 239 | manager.sectionPaste(what); 240 | } 241 | ) 242 | ); 243 | 244 | // Toggle load status script command 245 | context.subscriptions.push( 246 | vscode.commands.registerCommand( 247 | 'rgss-script-editor.sectionToggleLoad', 248 | (what) => { 249 | manager.sectionToggleLoad(what); 250 | } 251 | ) 252 | ); 253 | 254 | // Toggle collapsible status command 255 | context.subscriptions.push( 256 | vscode.commands.registerCommand( 257 | 'rgss-script-editor.sectionToggleCollapse', 258 | (what) => { 259 | manager.sectionToggleCollapse(what); 260 | } 261 | ) 262 | ); 263 | 264 | // Reveal script section on VSCode explorer command 265 | context.subscriptions.push( 266 | vscode.commands.registerCommand( 267 | 'rgss-script-editor.sectionRevealInVSCodeExplorer', 268 | (what) => { 269 | manager.revealInVSCodeExplorer(what); 270 | } 271 | ) 272 | ); 273 | 274 | // Copy section absolute path command 275 | context.subscriptions.push( 276 | vscode.commands.registerCommand( 277 | 'rgss-script-editor.sectionCopyAbsolutePath', 278 | (what) => { 279 | manager.sectionCopyAbsolutePath(what); 280 | } 281 | ) 282 | ); 283 | 284 | // Copy section relative path command 285 | context.subscriptions.push( 286 | vscode.commands.registerCommand( 287 | 'rgss-script-editor.sectionCopyRelativePath', 288 | (what) => { 289 | manager.sectionCopyRelativePath(what); 290 | } 291 | ) 292 | ); 293 | 294 | // Reveal script section on file explorer command 295 | context.subscriptions.push( 296 | vscode.commands.registerCommand( 297 | 'rgss-script-editor.sectionOpenInExplorer', 298 | (what) => { 299 | manager.revealInFileExplorer(what); 300 | } 301 | ) 302 | ); 303 | 304 | // ********************************************************** 305 | // Start extension logic 306 | // ********************************************************** 307 | 308 | // Restart manager 309 | manager.restart(); 310 | } 311 | 312 | /** 313 | * This method is called when your extension is deactivated. 314 | */ 315 | export function deactivate() { 316 | manager.dispose(); 317 | } 318 | -------------------------------------------------------------------------------- /src/modules/context/vscode_context.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | /** 4 | * Sets extension's valid working folder context state. 5 | * @param contextState Context state value 6 | */ 7 | export function setOpenedProjectFolder(contextState: boolean) { 8 | vscode.commands.executeCommand( 9 | 'setContext', 10 | 'rgss-script-editor.openedFolder', 11 | contextState 12 | ); 13 | } 14 | 15 | /** 16 | * Sets extension's extracted scripts context state. 17 | * @param contextState Context state value 18 | */ 19 | export function setExtractedScripts(contextState: boolean) { 20 | vscode.commands.executeCommand( 21 | 'setContext', 22 | 'rgss-script-editor.extractedScripts', 23 | contextState 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /src/modules/processes/gameplay_controller.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as cp from 'child_process'; 3 | import * as fs from 'fs'; 4 | import * as vscode from 'vscode'; 5 | import * as marshal from '@hyrious/marshal'; 6 | import { TextDecoder } from 'util'; 7 | import { Configuration, RunGameBehavior } from '../utils/configuration'; 8 | import { logger } from '../utils/logger'; 9 | 10 | /** 11 | * Ruby exception information type. 12 | * 13 | * The game process must format the exception to match this structure. 14 | */ 15 | type RubyExceptionInfo = { 16 | /** 17 | * Ruby exception type and name. 18 | */ 19 | type: any; 20 | 21 | /** 22 | * Ruby exception message. 23 | */ 24 | mesg: any; 25 | 26 | /** 27 | * Ruby exception backtrace list. 28 | */ 29 | back: any[]; 30 | }; 31 | 32 | /** 33 | * Game exception regular expression. 34 | * 35 | * Extracts the file, line and the message with a three group matches. 36 | * 37 | * If the message is not present, the third group will be ``undefined``. 38 | */ 39 | const GAME_EXCEPTION_REGEXP = /(.*):(\d+)(?::(.*))?/; 40 | 41 | /** 42 | * Exception backtrace information class. 43 | */ 44 | class GameExceptionBacktrace { 45 | /** 46 | * Absolute path to the file. 47 | * 48 | * This is the file that caused the exception. 49 | */ 50 | readonly file: string; 51 | 52 | /** 53 | * Line where the exception ocurred. 54 | */ 55 | readonly line: number; 56 | 57 | /** 58 | * Backtrace message. 59 | */ 60 | readonly message?: string; 61 | 62 | /** 63 | * Constructor. 64 | * @param file File absolute path. 65 | * @param line Line number. 66 | * @param message Optional message. 67 | */ 68 | constructor(file: string, line: number, message?: string) { 69 | this.file = file; 70 | this.line = line; 71 | this.message = message; 72 | } 73 | 74 | /** 75 | * Converts the backtrace into a string instance. 76 | * 77 | * If the backtrace message is available it will be appended. 78 | * @returns A string. 79 | */ 80 | toString(): string { 81 | return this.message 82 | ? `${this.file}\nat line ${this.line}: ${this.message}` 83 | : `${this.file}\nat line ${this.line}`; 84 | } 85 | } 86 | 87 | /** 88 | * Game exception class. 89 | */ 90 | export class GameException { 91 | /** 92 | * Exception name. 93 | */ 94 | readonly name: string; 95 | 96 | /** 97 | * Exception message. 98 | */ 99 | readonly message: string; 100 | 101 | /** 102 | * Exception creation timestamp. 103 | */ 104 | readonly timestamp: Date; 105 | 106 | /** 107 | * Backtrace list. 108 | */ 109 | readonly backtrace: GameExceptionBacktrace[]; 110 | 111 | /** 112 | * Constructor. 113 | * @param name Exception name. 114 | * @param message Exception message. 115 | */ 116 | constructor(name: string, message: string) { 117 | this.name = name; 118 | this.message = message; 119 | this.timestamp = new Date(); 120 | this.backtrace = []; 121 | } 122 | 123 | /** 124 | * Adds a new backtrace element with the given information. 125 | * @param file File absolute path. 126 | * @param line Line number. 127 | * @param message Optional message. 128 | */ 129 | addTrace(file: string, line: number, message?: string) { 130 | this.backtrace.push(new GameExceptionBacktrace(file, line, message)); 131 | } 132 | 133 | /** 134 | * Formats this extension to show itself on a VSCode Markdown document. 135 | * @returns Exception information. 136 | */ 137 | markdown(): string { 138 | // Document title 139 | let mark = '**RGSS Script Editor: Last Game Exception Report**\n\n'; 140 | 141 | // Document information 142 | mark = mark.concat( 143 | 'This document is used to display information about the exception that was thrown in the last game session.\n\n' 144 | ); 145 | mark = mark.concat( 146 | 'If you do not want this tab to appear in the editor, you can disable it in the extension options.\n\n' 147 | ); 148 | mark = mark.concat( 149 | 'The exception thrown will be shown in the following lines:\n\n' 150 | ); 151 | 152 | // Process exception basic info 153 | mark = mark.concat(`# ${this.name}\n\n`); 154 | mark = mark.concat(`${this.message}\n\n`); 155 | 156 | // Process exception time stamp 157 | mark = mark.concat('#### Timestamp\n\n'); 158 | mark = mark.concat(`${this.timestamp}\n\n`); 159 | 160 | // Process backtrace 161 | mark = mark.concat('#### Backtrace\n\n'); 162 | this.backtrace.forEach((item) => { 163 | mark = mark.concat('```\n'); 164 | mark = mark.concat(item.toString() + '\n'); 165 | mark = mark.concat('```\n'); 166 | }); 167 | return mark; 168 | } 169 | 170 | /** 171 | * Converts the exception into a string instance. 172 | * @returns A string. 173 | */ 174 | toString(): string { 175 | return `${this.name}: ${this.message}\n`; 176 | } 177 | } 178 | 179 | /** 180 | * Gameplay controller class. 181 | */ 182 | export class GameplayController { 183 | /** 184 | * Extension configuration instance. 185 | */ 186 | private _config?: Configuration; 187 | 188 | /** 189 | * Executable last exception. 190 | */ 191 | private _lastException?: GameException; 192 | 193 | /** 194 | * Executable processes. 195 | */ 196 | private _executables: Map; 197 | 198 | /** 199 | * Text decoder instance. 200 | */ 201 | private _textDecoder: TextDecoder; 202 | 203 | /** 204 | * Constructor. 205 | */ 206 | constructor() { 207 | this._config = undefined; 208 | this._lastException = undefined; 209 | this._executables = new Map(); 210 | this._textDecoder = new TextDecoder('utf8'); 211 | } 212 | 213 | /** 214 | * Gets the last exception instance that the game executable reported. 215 | * 216 | * If the game did not report any exception it returns ``undefined``. 217 | * @returns The last exception. 218 | */ 219 | get lastException() { 220 | return this._lastException; 221 | } 222 | 223 | /** 224 | * Gets if the game executable is currently running 225 | * @returns Whether it is running or not 226 | */ 227 | isRunning(): boolean { 228 | return this._executables.size > 0; 229 | } 230 | 231 | /** 232 | * Updates the extension configuration instance. 233 | * 234 | * The given ``configuration`` instance must be valid. 235 | * @param config Configuration instance. 236 | */ 237 | async update(config: Configuration) { 238 | // Make sure to dispose so info does not mix up between projects 239 | await this.dispose(); 240 | this._config = config; 241 | } 242 | 243 | /** 244 | * Disposes this gameplay controller instance. 245 | * 246 | * This method kills the executable if it is running (not undefined). 247 | * 248 | * To avoid invalid exception processing it sets the last exception to ``undefined``. 249 | * 250 | * The promise is resolved with the termination code 251 | */ 252 | async dispose() { 253 | return new Promise((resolve, reject) => { 254 | // Checks if there is any game process currently running 255 | if (!this.isRunning()) { 256 | resolve(); 257 | } 258 | 259 | // Kill all game processes and clear the hash tracker 260 | this._executables.forEach((gameProcess) => { 261 | gameProcess.kill(); 262 | }); 263 | 264 | // Clears attributes and resolve 265 | this._executables.clear(); 266 | this._lastException = undefined; 267 | resolve(); 268 | }); 269 | } 270 | 271 | /** 272 | * Asynchronously runs the game executable. 273 | * 274 | * If the game is spawned successfully it resolves the promise with its PID. 275 | * 276 | * If the game fails to run it rejects the promise with an error. 277 | * @returns A promise 278 | * @throws An error when process cannot be executed 279 | */ 280 | async runGame() { 281 | logger.logInfo('Trying to run the game executable...'); 282 | // Checks for configuration validness 283 | if (!this._config) { 284 | throw new Error('Cannot run the game because configuration is invalid!'); 285 | } 286 | // Checks if already running. 287 | if (this.isRunning()) { 288 | let gameBehavior = this._config.determineGameBehavior(); 289 | logger.logInfo(`Current game behavior: ${gameBehavior}`); 290 | 291 | // Process game behavior 292 | switch (gameBehavior) { 293 | case RunGameBehavior.NOTHING: 294 | throw new Error('Cannot run the game because it is already running!'); 295 | case RunGameBehavior.KILL_AND_RUN: 296 | await this.dispose(); 297 | break; 298 | case RunGameBehavior.ALLOW_MULTIPLE: 299 | break; 300 | default: 301 | throw new Error('Unknown run game behavior!'); 302 | } 303 | } 304 | 305 | // Preparation 306 | let workingDir = this._config.projectFolderPath?.fsPath; 307 | let gamePath = this._config.determineGamePath()?.fsPath; 308 | let gameArgs = this._config.determineGameArgs(); 309 | let exePath = ''; 310 | let exeArgs = []; 311 | let usingWine = false; 312 | logger.logInfo(`Game working directory: "${workingDir}"`); 313 | logger.logInfo(`Game executable path: "${gamePath}"`); 314 | logger.logInfo(`Game executable arguments: "${gameArgs}"`); 315 | 316 | // Safe-check for variables validness 317 | if (!workingDir || !gamePath || !gameArgs) { 318 | throw new Error('Cannot run the game due to invalid values!'); 319 | } 320 | // Checks if executable path exists 321 | if (!fs.existsSync(gamePath)) { 322 | throw new Error(`Game executable path: "${gamePath}" does not exists!`); 323 | } 324 | 325 | // Determine info based on the OS 326 | logger.logInfo(`Resolving game information based on platform...`); 327 | switch (process.platform) { 328 | case 'win32': { 329 | exePath = gamePath; 330 | exeArgs = gameArgs; 331 | break; 332 | } 333 | case 'darwin': 334 | case 'linux': { 335 | // Checks game executable 336 | if (this._isLinuxExecutable(gamePath)) { 337 | // It is a Linux executable, try to run it 338 | exePath = gamePath; 339 | exeArgs = gameArgs; 340 | } else { 341 | // It is likely that the game is a Windows executable, use Wine 342 | const wineCommand = this._config.configUseWine(); 343 | if (wineCommand.length > 0) { 344 | exePath = wineCommand; 345 | exeArgs = [`"${gamePath}"`, ...gameArgs]; 346 | usingWine = true; 347 | } else { 348 | throw new Error( 349 | 'Cannot run the game because it seems like a Windows executable and the command to run Wine is empty, check the extension settings to fix this' 350 | ); 351 | } 352 | } 353 | break; 354 | } 355 | default: { 356 | throw new Error( 357 | `Cannot launch the game because the platform: "${process.platform}" is unknown or not supported!` 358 | ); 359 | } 360 | } 361 | 362 | // Launch game process 363 | logger.logInfo(`Resolved process command: "${exePath}"`); 364 | logger.logInfo(`Resolved process arguments: "${exeArgs}"`); 365 | logger.logInfo('Spawning process...'); 366 | // Process should not be piped because if 'console' is passed as an argument to a RGSS3 367 | // executable, when the process spawns, it redirects $stdout and $stderr to the console window. 368 | // Making it impossible for the extension to listen to either $stdout or $stderr. 369 | const gameProcess = cp.spawn(exePath, exeArgs, { 370 | cwd: workingDir, 371 | stdio: ['ignore', 'ignore', 'ignore'], 372 | shell: usingWine, 373 | }); 374 | 375 | // Checks if the process spawned correctly 376 | if (gameProcess && gameProcess.pid) { 377 | // Prepares callbacks 378 | gameProcess.on('exit', (code, signal) => 379 | this._onProcessExit(gameProcess.pid!, code, signal) 380 | ); 381 | 382 | // Tracks the game process 383 | this._executables.set(gameProcess.pid, gameProcess); 384 | 385 | return gameProcess.pid; 386 | } else { 387 | return undefined; 388 | } 389 | } 390 | 391 | /** 392 | * Creates a ruby exception object from the given exception file 393 | * @param exceptionFilePath Exception file path 394 | * @throws An error if file does not exists 395 | * @throws An error if it is impossible to create a ruby exception object 396 | */ 397 | async createException(exceptionFilePath: string) { 398 | // Checks if the exception file path exists 399 | if (!fs.existsSync(exceptionFilePath)) { 400 | throw new Error( 401 | `Exception file path: "${exceptionFilePath}" does not exists!` 402 | ); 403 | } 404 | 405 | // If file exists, an exception ocurred in the last game session 406 | let contents = fs.readFileSync(exceptionFilePath); 407 | let rubyError = marshal.load(contents, { 408 | string: 'binary', 409 | hashSymbolKeysToString: true, 410 | }) as RubyExceptionInfo; 411 | // Process exception binary data 412 | let type = this._textDecoder.decode(rubyError.type); 413 | let mesg = this._textDecoder.decode(rubyError.mesg); 414 | let back = rubyError.back.map((item) => this._textDecoder.decode(item)); 415 | // Build the extension error instance 416 | let exception = new GameException(type, mesg); 417 | back.forEach((backtrace) => { 418 | let match = backtrace.match(GAME_EXCEPTION_REGEXP); 419 | if (match) { 420 | let file = match[1]; 421 | let line = parseInt(match[2]); 422 | let mesg = match[3]; 423 | // Skips invalid backtrace lines, only files that exists. 424 | // RPG Maker includes backtrace lines of scripts inside its built-in editor. 425 | if (fs.existsSync(file)) { 426 | exception.addTrace(file, line, mesg); 427 | } 428 | } 429 | }); 430 | // Updates last exception. 431 | this._lastException = exception; 432 | // Deletes output for next game run 433 | fs.unlinkSync(exceptionFilePath); 434 | // Executes command to process the exception. 435 | vscode.commands.executeCommand('rgss-script-editor.processGameException'); 436 | } 437 | 438 | /** 439 | * Method called when the current game process finishes its execution. 440 | * @param pid Game process PID. 441 | * @param code Exit code. 442 | * @param signal Exit signal. 443 | */ 444 | private _onProcessExit( 445 | pid: number, 446 | code: number | null, 447 | signal: NodeJS.Signals | null 448 | ) { 449 | logger.logInfo( 450 | `Game execution (PID: ${pid}) finished with code: ${code}, signal: ${signal}` 451 | ); 452 | 453 | // Resets for next game run 454 | this._executables.delete(pid); 455 | 456 | // Checks exception 457 | if (this._config) { 458 | // Checks output file for possible exceptions that killed the game 459 | let output = this._config.determineGameLogPath()?.fsPath; 460 | if (output && fs.existsSync(output)) { 461 | this.createException(output); 462 | } 463 | } 464 | } 465 | 466 | /** 467 | * Checks If the given file is an executable for Linux 468 | * @param file File path 469 | * @returns Whether it is an executable or not. 470 | */ 471 | private _isLinuxExecutable(file: string): boolean { 472 | try { 473 | fs.accessSync(file, fs.constants.X_OK); 474 | return !(path.extname(file).toLowerCase() === '.exe'); 475 | } catch (error: any) { 476 | return false; 477 | } 478 | } 479 | } 480 | -------------------------------------------------------------------------------- /src/modules/processes/open_folder.ts: -------------------------------------------------------------------------------- 1 | import * as cp from 'child_process'; 2 | import * as fs from 'fs'; 3 | 4 | /** 5 | * Asynchronously opens the given folder. 6 | * 7 | * If opening is successful it resolves the promise with the child process. 8 | * 9 | * If opening fails it rejects the promise with an error instance. 10 | * @param folderPath Absolute path to the folder 11 | * @returns A child process instance 12 | */ 13 | export async function openFolder(folderPath: string): Promise { 14 | // Checks if path exists 15 | if (!fs.existsSync(folderPath)) { 16 | throw new Error(`The given folder path: "${folderPath}" does not exists!`); 17 | } 18 | // Open folder 19 | let command = ''; 20 | switch (process.platform) { 21 | case 'win32': { 22 | command = `start "RGSS Script Editor" "${folderPath}"`; 23 | break; 24 | } 25 | case 'linux': { 26 | command = `xdg-open "${folderPath}"`; 27 | break; 28 | } 29 | case 'darwin': { 30 | command = `open "${folderPath}"`; 31 | break; 32 | } 33 | default: { 34 | throw new Error( 35 | `Cannot open folder because the platform: "${process.platform}" is not supported!` 36 | ); 37 | } 38 | } 39 | let folderProcess = cp.exec(command); 40 | return folderProcess; 41 | } 42 | -------------------------------------------------------------------------------- /src/modules/ui/elements/ui_status_bar.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import * as strings from '../../utils/strings'; 3 | 4 | /** 5 | * Status bar control options type. 6 | */ 7 | export type StatusBarControl = { 8 | /** 9 | * Open project folder status bar item visibility status. 10 | */ 11 | changeProjectFolder?: boolean; 12 | 13 | /** 14 | * Current project folder status bar item visibility status. 15 | */ 16 | currentProjectFolder?: boolean; 17 | 18 | /** 19 | * Extract scripts bar item visibility status. 20 | */ 21 | extractScripts?: boolean; 22 | 23 | /** 24 | * Run game executable status bar item visibility status. 25 | */ 26 | runGame?: boolean; 27 | }; 28 | 29 | /** 30 | * Status bar options type. 31 | */ 32 | export type StatusBarOptions = { 33 | /** 34 | * Project folder shown in the status bar. 35 | */ 36 | projectFolder: string; 37 | }; 38 | 39 | /** 40 | * Status bar UI items class. 41 | */ 42 | export class StatusBarItems { 43 | /** 44 | * Status bar set project folder item. 45 | */ 46 | private itemSetProjectFolder: vscode.StatusBarItem; 47 | /** 48 | * Status bar project folder item. 49 | */ 50 | private itemProjectFolder: vscode.StatusBarItem; 51 | /** 52 | * Status bar extract scripts item. 53 | */ 54 | private itemExtractScripts: vscode.StatusBarItem; 55 | /** 56 | * Status bar run game item. 57 | */ 58 | private itemRunGame: vscode.StatusBarItem; 59 | 60 | /** 61 | * Constructor. 62 | */ 63 | constructor() { 64 | this.itemSetProjectFolder = vscode.window.createStatusBarItem( 65 | vscode.StatusBarAlignment.Left 66 | ); 67 | this.itemProjectFolder = vscode.window.createStatusBarItem( 68 | vscode.StatusBarAlignment.Left 69 | ); 70 | this.itemExtractScripts = vscode.window.createStatusBarItem( 71 | vscode.StatusBarAlignment.Left 72 | ); 73 | this.itemRunGame = vscode.window.createStatusBarItem( 74 | vscode.StatusBarAlignment.Left 75 | ); 76 | this._initialize(); 77 | } 78 | 79 | /** 80 | * Updates status bar instance with the given options. 81 | * @param options Status bar options. 82 | */ 83 | update(options: StatusBarOptions): void { 84 | this.itemProjectFolder.text = `$(folder) ${vscode.l10n.t( 85 | strings.UI_PROJECT_FOLDER_TEXT, 86 | options.projectFolder 87 | )}`; 88 | } 89 | 90 | /** 91 | * Shows all items on the status bar. 92 | */ 93 | show() { 94 | this.control({ 95 | changeProjectFolder: true, 96 | currentProjectFolder: true, 97 | extractScripts: true, 98 | runGame: true, 99 | }); 100 | } 101 | 102 | /** 103 | * Hides all items on the status bar. 104 | */ 105 | hide() { 106 | this.control(); 107 | } 108 | 109 | /** 110 | * Controls all status bar items visibility. 111 | * 112 | * If no options are given, it hides all items. 113 | * @param options Status bar options 114 | */ 115 | control(options?: StatusBarControl): void { 116 | // Updates set project folder item visibility 117 | options?.changeProjectFolder 118 | ? this.itemSetProjectFolder.show() 119 | : this.itemSetProjectFolder.hide(); 120 | // Updates project folder name item visibility 121 | options?.currentProjectFolder 122 | ? this.itemProjectFolder.show() 123 | : this.itemProjectFolder.hide(); 124 | // Updates extract scripts item visibility 125 | options?.extractScripts 126 | ? this.itemExtractScripts.show() 127 | : this.itemExtractScripts.hide(); 128 | // Updates run game item visibility 129 | options?.runGame ? this.itemRunGame.show() : this.itemRunGame.hide(); 130 | } 131 | 132 | /** 133 | * Disposes all items from the status bar. 134 | */ 135 | dispose() { 136 | this.itemSetProjectFolder.dispose(); 137 | this.itemProjectFolder.dispose(); 138 | this.itemExtractScripts.dispose(); 139 | this.itemRunGame.dispose(); 140 | } 141 | 142 | /** 143 | * Initializes the status bar items. 144 | */ 145 | private _initialize() { 146 | // Set Project Folder item 147 | this.itemSetProjectFolder.name = strings.UI_SET_PROJECT_NAME; 148 | this.itemSetProjectFolder.text = `$(folder-library) ${strings.UI_SET_PROJECT_TEXT}`; 149 | this.itemSetProjectFolder.tooltip = strings.UI_SET_PROJECT_TOOLTIP; 150 | this.itemSetProjectFolder.command = 'rgss-script-editor.setProjectFolder'; 151 | 152 | // Opened Project Folder item 153 | this.itemProjectFolder.name = strings.UI_PROJECT_FOLDER_NAME; 154 | this.itemProjectFolder.text = `$(folder) ${vscode.l10n.t( 155 | strings.UI_PROJECT_FOLDER_TEXT, 156 | '-' 157 | )}`; 158 | this.itemProjectFolder.tooltip = strings.UI_PROJECT_FOLDER_TOOLTIP; 159 | this.itemProjectFolder.command = 'rgss-script-editor.openProjectFolder'; 160 | 161 | // Run Game item 162 | this.itemRunGame.name = strings.UI_RUN_GAME_NAME; 163 | this.itemRunGame.text = `$(run) ${strings.UI_RUN_GAME_TEXT}`; 164 | this.itemRunGame.tooltip = strings.UI_RUN_GAME_TOOLTIP; 165 | this.itemRunGame.command = 'rgss-script-editor.runGame'; 166 | 167 | // Extract Scripts item 168 | this.itemExtractScripts.name = strings.UI_EXTRACT_NAME; 169 | this.itemExtractScripts.text = `$(arrow-down) ${strings.UI_EXTRACT_TEXT}`; 170 | this.itemExtractScripts.tooltip = strings.UI_EXTRACT_TOOLTIP; 171 | this.itemExtractScripts.command = 'rgss-script-editor.extractScripts'; 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /src/modules/ui/elements/ui_tree_view_provider.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { UUID } from 'crypto'; 3 | import { 4 | EditorSectionBase, 5 | EditorSectionType, 6 | } from '../../processes/scripts_controller'; 7 | 8 | /** 9 | * Drag and drop MIME type. 10 | */ 11 | const MIME_TYPE = 'application/rgss.script.editor'; 12 | 13 | /** 14 | * VScode editor MIME type. 15 | */ 16 | const MIME_TYPE_VSCODE = 'text/uri-list'; 17 | 18 | /** 19 | * A data provider that provides tree data. 20 | */ 21 | export class EditorViewProvider 22 | implements 23 | vscode.TreeDataProvider, 24 | vscode.TreeDragAndDropController 25 | { 26 | /** 27 | * Scripts folder data. 28 | */ 29 | private _root?: EditorSectionBase; 30 | 31 | /** 32 | * On did change tree data event emitter. 33 | */ 34 | private _onDidChangeTreeData: vscode.EventEmitter< 35 | EditorSectionBase | undefined | null | void 36 | > = new vscode.EventEmitter(); 37 | 38 | /** 39 | * On did change tree data event. 40 | */ 41 | readonly onDidChangeTreeData: vscode.Event< 42 | EditorSectionBase | undefined | null | void 43 | > = this._onDidChangeTreeData.event; 44 | 45 | /** 46 | * Drop accepted MIME types. 47 | */ 48 | readonly dropMimeTypes: readonly string[] = [MIME_TYPE]; 49 | 50 | /** 51 | * Drag accepted MIME types. 52 | */ 53 | readonly dragMimeTypes: readonly string[] = [MIME_TYPE]; 54 | 55 | /** 56 | * Constructor. 57 | */ 58 | constructor() { 59 | this._root = undefined; 60 | } 61 | 62 | /** 63 | * Checks if ``section`` is the root section 64 | * @param section Editor section 65 | * @returns Whether it is root or not 66 | */ 67 | isRoot(section: EditorSectionBase): boolean { 68 | return this._root === section; 69 | } 70 | 71 | /** 72 | * Checks if URI of ``section`` is the root section URI 73 | * @param section Editor section 74 | * @returns Whether it is root or not 75 | */ 76 | isRootPath(section: EditorSectionBase): boolean { 77 | if (!this._root) { 78 | return false; 79 | } 80 | return this._root?.isPath(section.resourceUri); 81 | } 82 | 83 | /** 84 | * Handles a drag operation in the tree. 85 | * @param source List of tree items 86 | * @param dataTransfer Data transfer 87 | * @param token Token 88 | */ 89 | handleDrag( 90 | source: readonly EditorSectionBase[], 91 | dataTransfer: vscode.DataTransfer, 92 | token: vscode.CancellationToken 93 | ): Thenable | void { 94 | // Prepares data (must be stringified) 95 | let extensionData: UUID[] = []; 96 | let vscodeData: string[] = []; 97 | source.forEach((section) => { 98 | extensionData.push(section.id); 99 | 100 | // Checks editor section validness for VSCode editor 101 | // URIs needs to be strings separated by "\r\n" EOL for VSCode editor (hardcoded) 102 | // https://code.visualstudio.com/api/references/vscode-api#TreeDragAndDropController 103 | if (section.isType(EditorSectionType.Script)) { 104 | vscodeData.push(section.resourceUri.toString()); 105 | } else if (section.isType(EditorSectionType.Folder)) { 106 | section.nestedChildren().forEach((child) => { 107 | if (child.isType(EditorSectionType.Script)) { 108 | vscodeData.push(child.resourceUri.toString()); 109 | } 110 | }); 111 | } 112 | }); 113 | 114 | // Sets data transfer package with the data 115 | dataTransfer.set(MIME_TYPE, new vscode.DataTransferItem(extensionData)); 116 | if (vscodeData.length > 0) { 117 | dataTransfer.set( 118 | MIME_TYPE_VSCODE, 119 | new vscode.DataTransferItem(vscodeData.join('\r\n')) 120 | ); 121 | } 122 | } 123 | 124 | /** 125 | * Handles a drop operation on the tree. 126 | * @param target Target tree item 127 | * @param dataTransfer Data transfer 128 | * @param token Token 129 | */ 130 | handleDrop( 131 | target: EditorSectionBase | undefined, 132 | dataTransfer: vscode.DataTransfer, 133 | token: vscode.CancellationToken 134 | ): Thenable | void { 135 | // Checks target validness 136 | if (!target) { 137 | return; 138 | } 139 | 140 | // Gets data from the transfer package 141 | const ids = dataTransfer.get(MIME_TYPE)?.value as UUID[]; 142 | let sections: EditorSectionBase[] = []; 143 | if (!ids) { 144 | return; 145 | } 146 | 147 | // Fetchs the appropiate editor section instances by UUID. 148 | ids.forEach((id) => { 149 | const child = this._root?.findChild((value) => { 150 | return value.id === id; 151 | }, true); 152 | if (child) { 153 | sections.push(child); 154 | } 155 | }); 156 | 157 | if (sections.length > 0) { 158 | // Calls drap and drop command 159 | vscode.commands.executeCommand( 160 | 'rgss-script-editor.sectionMove', 161 | sections, 162 | target 163 | ); 164 | } 165 | } 166 | 167 | /** 168 | * This method signals that an element or root has changed in the tree. 169 | * 170 | * This will trigger the view to update the changed element/root and its children recursively (if shown). 171 | * 172 | * To signal that root has changed, do not pass any argument or pass undefined or null. 173 | * @param element Script Section 174 | */ 175 | refresh(element?: EditorSectionBase): void { 176 | this._onDidChangeTreeData.fire(element); 177 | } 178 | 179 | /** 180 | * Updates the provider script section root instance. 181 | * 182 | * This method triggers a refresh on the tree since data has been updated. 183 | * @param root Script section root 184 | */ 185 | update(root: EditorSectionBase) { 186 | this._root = root; 187 | this.refresh(); 188 | } 189 | 190 | /** 191 | * Resets the provider. 192 | * 193 | * This method undefines the tree view root instance. 194 | * 195 | * This method triggers a refresh on the tree since data has been updated. 196 | */ 197 | reset() { 198 | this._root = undefined; 199 | this.refresh(); 200 | } 201 | 202 | /** 203 | * Reveals the appropiate script section on the tree view based on the given ``uri``. 204 | * @param uri Script section uri path 205 | */ 206 | findTreeItem(uri: vscode.Uri) { 207 | return this._root?.findChild((value) => { 208 | return value.isPath(uri); 209 | }, true); 210 | } 211 | 212 | /** 213 | * Returns the UI representation (TreeItem) of the element that gets displayed in the view. 214 | * @param element Element 215 | * @returns Tree item 216 | */ 217 | getTreeItem( 218 | element: EditorSectionBase 219 | ): vscode.TreeItem | Thenable { 220 | return element; 221 | } 222 | 223 | /** 224 | * Gets a list of tree items by the given base script section. 225 | * 226 | * If ``element`` is nullish, it returns all children from the root. 227 | * 228 | * If ``element`` is a valid script section, it returns all of their children items. 229 | * @param element Base script section 230 | * @returns Returns the data 231 | */ 232 | getChildren( 233 | element?: EditorSectionBase 234 | ): vscode.ProviderResult { 235 | try { 236 | if (this._root) { 237 | let children = element ? element.children : this._root.children; 238 | return Promise.resolve(children); 239 | } else { 240 | return Promise.resolve([]); 241 | } 242 | } catch (error) { 243 | return Promise.resolve([]); 244 | } 245 | } 246 | 247 | /** 248 | * Gets the parent tree item (script section) of the given element. 249 | * @param element Script section 250 | * @returns Returns the element's parent 251 | */ 252 | getParent( 253 | element: EditorSectionBase 254 | ): vscode.ProviderResult { 255 | return element.parent; 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /src/modules/ui/ui_extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { EditorSectionBase } from '../processes/scripts_controller'; 3 | import { 4 | StatusBarControl, 5 | StatusBarOptions, 6 | StatusBarItems, 7 | } from './elements/ui_status_bar'; 8 | import { EditorViewProvider } from './elements/ui_tree_view_provider'; 9 | 10 | /** 11 | * Extension UI tree view reveal options type. 12 | */ 13 | export type ExtensionUiReveal = { 14 | /** 15 | * Whether to force the tree view to appear or not. 16 | */ 17 | force?: boolean; 18 | 19 | /** 20 | * Selects the item in the tree view. 21 | */ 22 | select?: boolean; 23 | 24 | /** 25 | * Expands the parent items in the tree view. 26 | */ 27 | expand?: number | boolean; 28 | 29 | /** 30 | * Focuses the item in the tree view. 31 | */ 32 | focus?: boolean; 33 | }; 34 | 35 | /** 36 | * Extension UI options type. 37 | */ 38 | export type ExtensionUiOptions = { 39 | /** 40 | * Status bar options. 41 | */ 42 | statusBarOptions: StatusBarOptions; 43 | 44 | /** 45 | * Root of the tree view provider. 46 | * 47 | * This will be used by the view provider to provide data to the tree view. 48 | * 49 | * If it is ``undefined`` the tree view will be empty. 50 | */ 51 | treeRoot: T; 52 | }; 53 | 54 | /** 55 | * Extension UI class. 56 | */ 57 | export class ExtensionUI { 58 | /** 59 | * Tree view instance. 60 | */ 61 | private _editorView?: vscode.TreeView; 62 | 63 | /** 64 | * Tree view provider instance. 65 | */ 66 | private _editorViewProvider: EditorViewProvider; 67 | 68 | /** 69 | * Status bar items controller. 70 | */ 71 | private _statusBar: StatusBarItems; 72 | 73 | /** 74 | * Constructor. 75 | */ 76 | constructor() { 77 | this._editorViewProvider = new EditorViewProvider(); 78 | this._statusBar = new StatusBarItems(); 79 | this._editorView = vscode.window.createTreeView( 80 | 'rgss-script-editor.editorView', 81 | { 82 | treeDataProvider: this._editorViewProvider, 83 | dragAndDropController: this._editorViewProvider, 84 | canSelectMany: true, 85 | manageCheckboxStateManually: true, 86 | showCollapseAll: true, 87 | } 88 | ); 89 | 90 | // Checkbox click callback. 91 | this._editorView.onDidChangeCheckboxState((e) => { 92 | vscode.commands.executeCommand( 93 | 'rgss-script-editor.sectionToggleLoad', 94 | e.items 95 | ); 96 | }); 97 | 98 | // Collapse callback 99 | this._editorView.onDidCollapseElement((e) => { 100 | vscode.commands.executeCommand( 101 | 'rgss-script-editor.sectionToggleCollapse', 102 | e.element 103 | ); 104 | }); 105 | 106 | // Expand callback 107 | this._editorView.onDidExpandElement((e) => { 108 | vscode.commands.executeCommand( 109 | 'rgss-script-editor.sectionToggleCollapse', 110 | e.element 111 | ); 112 | }); 113 | } 114 | 115 | /** 116 | * Gets all current items selected on the tree view. 117 | * 118 | * If there are not items selected it returns ``undefined``. 119 | * @returns Tree view selection. 120 | */ 121 | getTreeSelection() { 122 | return this._editorView?.selection; 123 | } 124 | 125 | /** 126 | * Updates the extension UI with the given options. 127 | * @param options Extension UI options. 128 | */ 129 | async update(options: ExtensionUiOptions) { 130 | // Updates status bar items 131 | this._statusBar.update(options.statusBarOptions); 132 | 133 | // Updates view provider 134 | this._editorViewProvider.update(options.treeRoot); 135 | } 136 | 137 | /** 138 | * Resets the extension UI to the default values. 139 | * 140 | * It resets the current tree view provider and hides the status bar. 141 | */ 142 | reset() { 143 | this._editorViewProvider.reset(); 144 | this._statusBar.hide(); 145 | } 146 | 147 | /** 148 | * Reveals the appropiate script section in the tree view by the given ``uri`` path. 149 | * @param uri Script section uri path. 150 | * @param options Reveal options. 151 | * @returns A promise with the script section revealed. 152 | */ 153 | async revealInTreeView(uri: vscode.Uri, options: ExtensionUiReveal) { 154 | if (this._editorView?.visible || options.force) { 155 | // Avoids conflicts with other container auto reveals 156 | let section = this._editorViewProvider?.findTreeItem(uri); 157 | 158 | // Check editor section validness 159 | if (!section) { 160 | return; 161 | } 162 | 163 | // Reveals the target editor section 164 | await this._editorView?.reveal(section, { 165 | select: options.select, 166 | expand: options.expand, 167 | focus: options.focus, 168 | }); 169 | return section; 170 | } 171 | } 172 | 173 | /** 174 | * Refreshes the UI contents. 175 | * 176 | * If ``isRoot`` is ``true``, it will update the current root and refresh the whole tree. 177 | * 178 | * Otherwise it will just refresh the given tree item and all of its children. 179 | * @param treeItem Tree item to refresh 180 | * @param isRoot Whether tree item is root or not 181 | */ 182 | refresh(treeItem: EditorSectionBase, isRoot?: boolean) { 183 | if (isRoot) { 184 | this._editorViewProvider.update(treeItem); 185 | } else { 186 | this._editorViewProvider.refresh(treeItem); 187 | } 188 | } 189 | 190 | /** 191 | * Shows all extension UI elements. 192 | */ 193 | show() { 194 | // Shows status bar items. 195 | this._statusBar.show(); 196 | } 197 | 198 | /** 199 | * Hides all extension UI elements. 200 | */ 201 | hide() { 202 | // Hides status bar items. 203 | this._statusBar.hide(); 204 | } 205 | 206 | /** 207 | * Controls the extension UI elements. 208 | * @param options Extension UI options. 209 | */ 210 | control(options?: StatusBarControl): void { 211 | this._statusBar.control(options); 212 | } 213 | 214 | /** 215 | * Disposes all extension UI elements. 216 | */ 217 | async dispose() { 218 | // Disposes all status bar items 219 | this._statusBar.dispose(); 220 | 221 | // Disposes the editor view 222 | this._editorView?.dispose(); 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /src/modules/utils/configuration.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as fs from 'fs'; 3 | import * as vscode from 'vscode'; 4 | 5 | /** 6 | * Project folder information. 7 | */ 8 | export type FolderInfo = { 9 | /** 10 | * Absolute path to the project folder. 11 | */ 12 | projectFolderPath: vscode.Uri; 13 | 14 | /** 15 | * Project folder name. 16 | */ 17 | projectFolderName: string; 18 | 19 | /** 20 | * RGSS version. 21 | */ 22 | rgssVersion: string; 23 | }; 24 | 25 | /** 26 | * Return type when changing the current project folder. 27 | */ 28 | export type ConfigChangeFolder = { 29 | oldProjectFolder?: FolderInfo; 30 | curProjectFolder: FolderInfo; 31 | }; 32 | 33 | /** 34 | * Enum of types of run game behaviors 35 | */ 36 | export const enum RunGameBehavior { 37 | NOTHING = 'nothing', 38 | KILL_AND_RUN = 'kill and run', 39 | ALLOW_MULTIPLE = 'allow multiple', 40 | } 41 | 42 | /** 43 | * Enum of script name validation types 44 | */ 45 | export const enum NameValidation { 46 | AUTO = 'auto', 47 | ALWAYS = 'always', 48 | NEVER = 'never', 49 | } 50 | 51 | /** 52 | * Enum of valid RGSS versions. 53 | */ 54 | const enum RGSSVersion { 55 | RGSS1 = 'RGSS1', 56 | RGSS2 = 'RGSS2', 57 | RGSS3 = 'RGSS3', 58 | } 59 | 60 | /** 61 | * Enum of valid game test arguments based on the RGSS version. 62 | */ 63 | const enum RGSSGameArgsTest { 64 | RGSS1 = 'debug', 65 | RGSS2 = 'test', 66 | RGSS3 = 'test', 67 | } 68 | 69 | /** 70 | * Enum of valid game console arguments based on the RGSS version. 71 | */ 72 | const enum RGSSGameArgsConsole { 73 | RGSS1 = '', 74 | RGSS2 = '', 75 | RGSS3 = 'console', 76 | } 77 | 78 | /** 79 | * Enum of relative paths from the project folder to the bundle scripts file based on the RGSS version. 80 | */ 81 | const enum RGSSBundlePath { 82 | RGSS1 = 'Data/Scripts.rxdata', 83 | RGSS2 = 'Data/Scripts.rvdata', 84 | RGSS3 = 'Data/Scripts.rvdata2', 85 | } 86 | 87 | /** 88 | * Enum of file's end of line types 89 | */ 90 | const enum FilesEOL { 91 | AUTO = 'auto', 92 | CRLF = '\r\n', 93 | LF = '\n', 94 | } 95 | 96 | /** 97 | * Determine path options 98 | */ 99 | type DeterminePathOptions = { 100 | /** 101 | * Whether to remove the file segment from the path or not 102 | */ 103 | removeFilePart?: boolean; 104 | }; 105 | 106 | /** 107 | * Determine extension options 108 | */ 109 | type DetermineExtensionOptions = { 110 | /** 111 | * Whether to remove the extension dot or not 112 | */ 113 | removeDot?: boolean; 114 | }; 115 | 116 | /** 117 | * Configuration class 118 | */ 119 | export class Configuration { 120 | /** 121 | * Log file name. 122 | * 123 | * Log file that is created inside the active project folder. 124 | */ 125 | public static LOG_FILE_NAME = 'extension.log'; 126 | 127 | /** 128 | * Game execution output file name. 129 | * 130 | * This file is created by the game when an exception kills the process. 131 | * 132 | * The exception's name and the backtrace are written inside of it. 133 | */ 134 | public static GAME_OUTPUT_FILE = 'game.log'; 135 | 136 | /** 137 | * File name of the backup file that the user creates from the extracted scripts. 138 | * 139 | * The name should not have extensions since it will get automatically determined 140 | * based on the RGSS version on runtime. 141 | */ 142 | public static BACKUP_SCRIPTS_FILE_NAME = 'Manual Backup of Extracted Scripts'; 143 | 144 | /** 145 | * File name of the backup file that the user creates from the load order. 146 | */ 147 | public static BACKUP_LOAD_ORDER_FILE_NAME = 'Load Order Backup'; 148 | 149 | /** 150 | * File name for the compiled scripts bundle file 151 | * 152 | * The name should not have extensions since it will get automatically determined 153 | * based on the RGSS version on runtime. 154 | */ 155 | public static COMPILE_SCRIPTS_FILE_NAME = 'Scripts'; 156 | 157 | /** 158 | * RGSS Version. 159 | */ 160 | private _rgssVersion?: string; 161 | 162 | /** 163 | * Project folder URI path. 164 | */ 165 | private _projectFolderPath?: vscode.Uri; 166 | 167 | /** 168 | * Project folder name 169 | */ 170 | private _projectFolderName?: string; 171 | 172 | /** 173 | * Constructor. 174 | */ 175 | constructor() { 176 | this._rgssVersion = undefined; 177 | this._projectFolderPath = undefined; 178 | this._projectFolderName = undefined; 179 | } 180 | 181 | /** 182 | * RGSS Version. 183 | */ 184 | get rgss() { 185 | return this._rgssVersion; 186 | } 187 | 188 | /** 189 | * Project folder URI path. 190 | */ 191 | get projectFolderPath() { 192 | return this._projectFolderPath; 193 | } 194 | 195 | /** 196 | * Project folder name 197 | */ 198 | get projectFolderName() { 199 | return this._projectFolderName; 200 | } 201 | 202 | /** 203 | * Gets the extension quickstart status flag. 204 | * @returns Quickstart status flag. 205 | */ 206 | configQuickstart(): boolean { 207 | return this._getVSCodeConfig('extension.quickStart')!; 208 | } 209 | 210 | /** 211 | * Gets the extension auto reveal flag. 212 | * @returns Auto reveal flag. 213 | */ 214 | configAutoReveal(): boolean { 215 | return this._getVSCodeConfig('extension.autoReveal')!; 216 | } 217 | 218 | /** 219 | * Gets the extension file EOL type. 220 | * @returns File EOL sequence. 221 | */ 222 | configFileEOL(): string { 223 | return this._getVSCodeConfig('extension.filesEndOfLine')!; 224 | } 225 | 226 | /** 227 | * Gets the extension insert encoding magic comment flag. 228 | * @returns Insert encoding comment flag. 229 | */ 230 | configInsertEncodingComment(): boolean { 231 | return this._getVSCodeConfig('extension.insertEncodingComment')!; 232 | } 233 | 234 | /** 235 | * Gets the extension re-create script loader flag. 236 | * @returns Re-create script loader flag. 237 | */ 238 | configRecreateScriptLoader(): boolean { 239 | return this._getVSCodeConfig('extension.recreateScriptLoader')!; 240 | } 241 | 242 | /** 243 | * Gets the script name validation mode. 244 | * @returns Script name validation mode. 245 | */ 246 | configScriptNameValidation(): string { 247 | return this._getVSCodeConfig('extension.scriptNameValidation')!; 248 | } 249 | 250 | /** 251 | * Gets log to console flag status. 252 | * @returns Log to console flag. 253 | */ 254 | configLogConsole(): boolean { 255 | return this._getVSCodeConfig('debug.logToConsole')!; 256 | } 257 | 258 | /** 259 | * Gets log to file flag status. 260 | * @returns Log to file flag. 261 | */ 262 | configLogFile(): boolean { 263 | return this._getVSCodeConfig('debug.logToFile')!; 264 | } 265 | 266 | /** 267 | * Gets the project relative path to the back ups folder. 268 | * @returns Back ups folder path. 269 | */ 270 | configBackUpsFolder(): string { 271 | return this._getVSCodeConfig('external.backUpsFolder')!; 272 | } 273 | 274 | /** 275 | * Gets the project relative path to the load order back ups folder. 276 | * @returns Load order back ups folder path. 277 | */ 278 | configLoadOrderBackUpsFolder(): string { 279 | return this._getVSCodeConfig('external.loadOrderBackUpsFolder')!; 280 | } 281 | 282 | /** 283 | * Gets the project relative path to the extracted scripts folder. 284 | * @returns Scripts folder path. 285 | */ 286 | configScriptsFolder(): string { 287 | return this._getVSCodeConfig('external.scriptsFolder')!; 288 | } 289 | 290 | /** 291 | * Gets the project relative path to the extension log file folder. 292 | * @returns Log file folder. 293 | */ 294 | configLogFileFolder(): string { 295 | return this._getVSCodeConfig('external.extensionLogFileFolder')!; 296 | } 297 | 298 | /** 299 | * Gets the project relative path to the game log file folder. 300 | * @returns Log file folder. 301 | */ 302 | configGameLogFileFolder(): string { 303 | return this._getVSCodeConfig('external.gameLogFileFolder')!; 304 | } 305 | 306 | /** 307 | * Gets the project relative path to the compiled scripts folder. 308 | * @returns Scripts compiled folder path. 309 | */ 310 | configScriptsCompileFolder(): string { 311 | return this._getVSCodeConfig('external.scriptsCompileFolder')!; 312 | } 313 | 314 | /** 315 | * Gets the game executable relative path. 316 | * @returns Game executable relative path. 317 | */ 318 | configExeGamePath(): string { 319 | return this._getVSCodeConfig('gameplay.gameExecutablePath')!; 320 | } 321 | 322 | /** 323 | * Gets the Wine command to run the executable in Linux. 324 | * @returns Wine command. 325 | */ 326 | configUseWine(): string { 327 | return this._getVSCodeConfig('gameplay.useWine')!; 328 | } 329 | 330 | /** 331 | * Gets the run game behavior 332 | * @returns Run game behavior 333 | */ 334 | configRunGameBehavior(): string { 335 | return this._getVSCodeConfig('gameplay.runGameBehavior')!; 336 | } 337 | 338 | /** 339 | * Gets the game executable automatic arguments detection mode. 340 | * 341 | * When this mode is enabled custom arguments are ignored. 342 | * @returns Auto. Argument detection 343 | */ 344 | configExeArgsDetection(): boolean { 345 | return this._getVSCodeConfig( 346 | 'gameplay.automaticArgumentsDetection' 347 | )!; 348 | } 349 | 350 | /** 351 | * Gets whether the test mode is enabled or not. 352 | * @returns Test mode enable status. 353 | */ 354 | configExeTestMode(): boolean { 355 | return this._getVSCodeConfig('gameplay.editorTestMode')!; 356 | } 357 | 358 | /** 359 | * Gets whether the RPG Maker native console is enabled or not 360 | * @returns Native console enable status 361 | */ 362 | configExeConsole(): boolean { 363 | return this._getVSCodeConfig('gameplay.nativeConsole')!; 364 | } 365 | 366 | /** 367 | * Gets custom arguments to launch the game executable 368 | * 369 | * This must be used only when auto. arguments detection mode is turned off 370 | * @returns Custom arguments string 371 | */ 372 | configExeCustomArgs(): string { 373 | return this._getVSCodeConfig('gameplay.customArguments')!; 374 | } 375 | 376 | /** 377 | * Gets the extension game exception auto process flag. 378 | * @returns Auto process extension flag. 379 | */ 380 | configGameErrorAutoProcess(): boolean { 381 | return this._getVSCodeConfig('gameplay.gameExceptionAutoProcess')!; 382 | } 383 | 384 | /** 385 | * Gets the extension game exception shows in the editor window flag. 386 | * @returns Show in the editor flag. 387 | */ 388 | configGameErrorShowEditor(): boolean { 389 | return this._getVSCodeConfig( 390 | 'gameplay.gameExceptionShowInEditor' 391 | )!; 392 | } 393 | 394 | /** 395 | * Checks if this configuration instance is valid. 396 | * 397 | * Being valid means that a folder was opened and the RGSS version was detected. 398 | * 399 | * If the RGSS version was detected, the rest of attributes are assumed to be valid. 400 | * @returns Whether it is valid or not. 401 | */ 402 | isValid(): boolean { 403 | return !!this._rgssVersion; 404 | } 405 | 406 | /** 407 | * Gets information about the current opened project folder. 408 | * 409 | * If the current opened folder is not valid it returns ``undefined``. 410 | * @returns Folder information 411 | */ 412 | getInfo(): FolderInfo | undefined { 413 | if (this.isValid()) { 414 | return { 415 | rgssVersion: this._rgssVersion!, 416 | projectFolderPath: this._projectFolderPath!, 417 | projectFolderName: this._projectFolderName!, 418 | }; 419 | } 420 | return undefined; 421 | } 422 | 423 | /** 424 | * This method checks if the given ``folder`` is a valid RPG Maker project folder. 425 | * 426 | * If the folder is valid, it returns information about the folder, otherwise returns ``null``. 427 | * @param folder Folder Uri path. 428 | * @returns Folder information. 429 | */ 430 | checkFolder(folder: vscode.Uri): FolderInfo | null { 431 | let projectName = path.basename(folder.fsPath); 432 | let rgss1 = vscode.Uri.joinPath(folder, RGSSBundlePath.RGSS1); 433 | let rgss2 = vscode.Uri.joinPath(folder, RGSSBundlePath.RGSS2); 434 | let rgss3 = vscode.Uri.joinPath(folder, RGSSBundlePath.RGSS3); 435 | // Formats the folder information based on the RGSS version 436 | if (fs.existsSync(rgss1.fsPath)) { 437 | return { 438 | projectFolderPath: folder, 439 | rgssVersion: RGSSVersion.RGSS1, 440 | projectFolderName: projectName, 441 | }; 442 | } 443 | // Checks for RGSS2 444 | if (fs.existsSync(rgss2.fsPath)) { 445 | return { 446 | projectFolderPath: folder, 447 | rgssVersion: RGSSVersion.RGSS2, 448 | projectFolderName: projectName, 449 | }; 450 | } 451 | // Checks for RGSS3 452 | if (fs.existsSync(rgss3.fsPath)) { 453 | return { 454 | projectFolderPath: folder, 455 | rgssVersion: RGSSVersion.RGSS3, 456 | projectFolderName: projectName, 457 | }; 458 | } 459 | return null; 460 | } 461 | 462 | /** 463 | * Asynchronously updates the configuration with the given project folder. 464 | * 465 | * If the instance is updated successfully it returns information about the folder change. 466 | * 467 | * If it fails to update the folder it rejects the promise with an error. 468 | * @param folder Project Folder. 469 | * @throws An error when the given folder is invalid. 470 | * @returns A promise. 471 | */ 472 | async update(folder: vscode.Uri): Promise { 473 | let info = this.checkFolder(folder); 474 | if (info) { 475 | // RGSS version found, valid RPG Maker project folder. 476 | let oldProjectFolder = this.getInfo(); 477 | this._rgssVersion = info.rgssVersion; 478 | this._projectFolderPath = info.projectFolderPath; 479 | this._projectFolderName = info.projectFolderName; 480 | return { oldProjectFolder: oldProjectFolder, curProjectFolder: info }; 481 | } else { 482 | // RGSS version was not found, probably an invalid folder. 483 | this._rgssVersion = undefined; 484 | this._projectFolderPath = undefined; 485 | this._projectFolderName = undefined; 486 | throw new Error( 487 | `Cannot update to folder: ${folder.fsPath}. A valid RGSS version was not detected!` 488 | ); 489 | } 490 | } 491 | 492 | /** 493 | * Determines the path to the game scripts bundle file. 494 | * 495 | * The path is based on the current active folder and RGSS version. 496 | * 497 | * If the folder is not valid, it returns ``undefined`` 498 | * @returns Bundle file uri path 499 | */ 500 | determineBundleFilePath() { 501 | // Determines appropiate bundle based on the RGSS version 502 | let bundle = undefined; 503 | switch (this._rgssVersion) { 504 | case RGSSVersion.RGSS1: 505 | bundle = RGSSBundlePath.RGSS1; 506 | break; 507 | case RGSSVersion.RGSS2: 508 | bundle = RGSSBundlePath.RGSS2; 509 | break; 510 | case RGSSVersion.RGSS3: 511 | bundle = RGSSBundlePath.RGSS3; 512 | break; 513 | default: 514 | bundle = undefined; 515 | break; 516 | } 517 | // Join path with the appropiate bundle file 518 | return bundle ? this.joinProject(bundle) : undefined; 519 | } 520 | 521 | /** 522 | * Determines the path to the backups folder. 523 | * 524 | * The path is based on the current active folder. 525 | * 526 | * If the folder is not valid, it returns ``undefined`` 527 | * @returns Backups folder uri path 528 | */ 529 | determineBackupsPath() { 530 | return this.joinProject(this.configBackUpsFolder()); 531 | } 532 | 533 | /** 534 | * Determines the path to the load order backups folder. 535 | * 536 | * The path is based on the current active folder. 537 | * 538 | * If the folder is not valid, it returns ``undefined`` 539 | * @returns Backups folder uri path 540 | */ 541 | determineLoadOrderBackupsPath() { 542 | return this.joinProject(this.configLoadOrderBackUpsFolder()); 543 | } 544 | 545 | /** 546 | * Determines the path to the scripts folder from the current project's folder. 547 | * @returns Scripts folder uri path 548 | */ 549 | determineScriptsPath() { 550 | return this.joinProject(this.configScriptsFolder()); 551 | } 552 | 553 | /** 554 | * Determines the path to the log file. 555 | * 556 | * The path is based on the current active folder. 557 | * 558 | * If the folder is not valid, it returns ``undefined`` 559 | * 560 | * @param options Options 561 | * @returns Log file uri path 562 | */ 563 | determineLogFilePath(options?: DeterminePathOptions) { 564 | if (options?.removeFilePart) { 565 | return this.joinProject(this.configLogFileFolder()); 566 | } else { 567 | return this.joinProject( 568 | this.configLogFileFolder(), 569 | Configuration.LOG_FILE_NAME 570 | ); 571 | } 572 | } 573 | 574 | /** 575 | * Determines the path to the game's output file. 576 | * 577 | * This file is used by the extension to process possible game exceptions. 578 | * 579 | * The path is based on the current active folder. 580 | * 581 | * If the folder is not valid, it returns ``undefined`` 582 | * 583 | * @param options Options 584 | * @returns Game output file uri path 585 | */ 586 | determineGameLogPath(options?: DeterminePathOptions) { 587 | if (options?.removeFilePart) { 588 | return this.joinProject(this.configGameLogFileFolder()); 589 | } else { 590 | return this.joinProject( 591 | this.configGameLogFileFolder(), 592 | Configuration.GAME_OUTPUT_FILE 593 | ); 594 | } 595 | } 596 | 597 | /** 598 | * Determines the path to the scripts compile folder from the current project's folder. 599 | * 600 | * The file extension is determined based on the RPG Maker version detected. 601 | * 602 | * @param options Options 603 | * @returns Scripts compile folder uri path 604 | */ 605 | determineScriptsCompilePath(options?: DeterminePathOptions) { 606 | if (options?.removeFilePart) { 607 | return this.joinProject(this.configScriptsCompileFolder()); 608 | } else { 609 | let uri = this.joinProject( 610 | this.configScriptsCompileFolder(), 611 | Configuration.COMPILE_SCRIPTS_FILE_NAME 612 | ); 613 | 614 | // Adds the appropiate extension 615 | if (uri) { 616 | uri = this.processExtension(uri); 617 | } 618 | return uri; 619 | } 620 | } 621 | 622 | /** 623 | * Determines the path to the game executable. 624 | * 625 | * The path is based on the current active folder. 626 | * 627 | * If the folder is not valid, it returns ``undefined`` 628 | * @returns Game executable uri path 629 | */ 630 | determineGamePath() { 631 | return this.joinProject(this.configExeGamePath()); 632 | } 633 | 634 | /** 635 | * Determines the appropiate game executable arguments. 636 | * 637 | * If automatic argument detection is enabled it will ignore custom arguments. 638 | * 639 | * If the arguments cannot be determined it returns ``undefined``. 640 | * @returns List of game arguments. 641 | */ 642 | determineGameArgs(): string[] | undefined { 643 | let args: string[] = []; 644 | // Auto. arguments detection enabled 645 | if (this.configExeArgsDetection()) { 646 | switch (this._rgssVersion) { 647 | case RGSSVersion.RGSS1: { 648 | // Test argument 649 | if (this.configExeTestMode() && !!RGSSGameArgsTest.RGSS1) { 650 | args.push(RGSSGameArgsTest.RGSS1); 651 | } 652 | // Console argument 653 | if (this.configExeConsole() && !!RGSSGameArgsConsole.RGSS1) { 654 | args.push(RGSSGameArgsConsole.RGSS1); 655 | } 656 | return args; 657 | } 658 | case RGSSVersion.RGSS2: { 659 | // Test argument 660 | if (this.configExeTestMode() && !!RGSSGameArgsTest.RGSS2) { 661 | args.push(RGSSGameArgsTest.RGSS2); 662 | } 663 | // Console argument 664 | if (this.configExeConsole() && !!RGSSGameArgsConsole.RGSS2) { 665 | args.push(RGSSGameArgsConsole.RGSS2); 666 | } 667 | return args; 668 | } 669 | case RGSSVersion.RGSS3: { 670 | // Test argument 671 | if (this.configExeTestMode() && !!RGSSGameArgsTest.RGSS3) { 672 | args.push(RGSSGameArgsTest.RGSS3); 673 | } 674 | // Console argument 675 | if (this.configExeConsole() && !!RGSSGameArgsConsole.RGSS3) { 676 | args.push(RGSSGameArgsConsole.RGSS3); 677 | } 678 | return args; 679 | } 680 | default: { 681 | return undefined; 682 | } 683 | } 684 | } else { 685 | // Custom arguments 686 | this.configExeCustomArgs() 687 | ?.split(' ') 688 | .forEach((arg) => { 689 | args.push(arg); 690 | }); 691 | return args; 692 | } 693 | } 694 | 695 | /** 696 | * Determines the file EOL that the extension should use 697 | * @returns File EOL 698 | */ 699 | determineFileEOL(): string { 700 | let eol = this.configFileEOL(); 701 | 702 | // Checks if user is forcing a specific EOL (only valid EOLs) 703 | if (eol === FilesEOL.CRLF || eol === FilesEOL.LF) { 704 | return eol; 705 | } 706 | 707 | // Determine the EOL based on the current platform (auto) 708 | switch (process.platform) { 709 | case 'win32': 710 | return FilesEOL.CRLF; 711 | case 'linux': 712 | case 'darwin': 713 | return FilesEOL.LF; 714 | default: 715 | return FilesEOL.LF; 716 | } 717 | } 718 | 719 | /** 720 | * Determines if the extension should validate script names or not 721 | * @returns Script name validation 722 | */ 723 | determineNameValidation(): boolean { 724 | let mode = this.configScriptNameValidation(); 725 | 726 | // Checks depending of the mode 727 | switch (mode) { 728 | case NameValidation.ALWAYS: 729 | return true; 730 | case NameValidation.NEVER: 731 | return false; 732 | case NameValidation.AUTO: 733 | if (this._rgssVersion === RGSSVersion.RGSS3) { 734 | return false; 735 | } else { 736 | return true; 737 | } 738 | 739 | default: 740 | return true; 741 | } 742 | } 743 | 744 | /** 745 | * Determines the game behavior 746 | * @returns Game behavior 747 | */ 748 | determineGameBehavior(): string { 749 | let gameBehavior = this.configRunGameBehavior(); 750 | 751 | // Checks behavior validness and returns the appropiate value 752 | switch (gameBehavior) { 753 | case RunGameBehavior.NOTHING: 754 | case RunGameBehavior.KILL_AND_RUN: 755 | case RunGameBehavior.ALLOW_MULTIPLE: 756 | return gameBehavior; 757 | default: 758 | return RunGameBehavior.NOTHING; 759 | } 760 | } 761 | 762 | /** 763 | * Joins all given path segments to the current project folder path. 764 | * 765 | * If the current project folder is invalid, it returns ``undefined``. 766 | * @param segments List of segments. 767 | * @returns Joined path. 768 | */ 769 | joinProject(...segments: string[]): vscode.Uri | undefined { 770 | if (this.isValid()) { 771 | return vscode.Uri.joinPath(this._projectFolderPath!, ...segments); 772 | } 773 | return undefined; 774 | } 775 | 776 | /** 777 | * Gets the relative path from the project's folder to the given uri 778 | * @param uri Target Uri path 779 | * @returns Relative path to ``uri`` 780 | */ 781 | fromProject(uri?: vscode.Uri): string | undefined { 782 | if (this.isValid() && uri) { 783 | return path.relative(this._projectFolderPath!.fsPath, uri.fsPath); 784 | } 785 | return undefined; 786 | } 787 | 788 | /** 789 | * Determines the appropiate bundle file extension based on the RGSS version detected. 790 | * @returns Bundle file extension 791 | */ 792 | determineExtension(options?: DetermineExtensionOptions): string { 793 | let extension = ''; 794 | switch (this.rgss) { 795 | case RGSSVersion.RGSS1: { 796 | extension = '.rxdata'; 797 | break; 798 | } 799 | case RGSSVersion.RGSS2: { 800 | extension = '.rvdata'; 801 | break; 802 | } 803 | case RGSSVersion.RGSS3: { 804 | extension = '.rvdata2'; 805 | break; 806 | } 807 | } 808 | 809 | // Whether to remove the dot or not 810 | if (options?.removeDot) { 811 | extension = extension.substring(1); 812 | } 813 | 814 | return extension; 815 | } 816 | 817 | /** 818 | * Processes the given uri path to append the proper extension. 819 | * 820 | * This method won't remove the extension if the uri path has one already. 821 | * @param filepath File path 822 | * @returns Processed file uri 823 | */ 824 | processExtension(filepath: vscode.Uri | string) { 825 | // Determine the proper extension based on the RGSS version detected 826 | let extension = this.determineExtension(); 827 | // Determines Uri based on the given argument type 828 | const uri = 829 | filepath instanceof vscode.Uri ? filepath : vscode.Uri.file(filepath); 830 | // Checks if proper extension is present already 831 | if (uri.fsPath.toLowerCase().endsWith(extension)) { 832 | return uri; 833 | } 834 | // Concatenates the proper extension 835 | const dirname = path.dirname(uri.fsPath); 836 | const basename = path.basename(uri.fsPath).concat(extension); 837 | return vscode.Uri.file(path.join(dirname, basename)); 838 | } 839 | 840 | /** 841 | * Creates a backup uri path with the given filename. 842 | * 843 | * If the backup path cannot be determined, it returns ``undefined``. 844 | * @param fileName File name 845 | * @returns The formatted backup uri path 846 | */ 847 | processBackupFilePath(fileName: string) { 848 | const backupsFolder = this.determineBackupsPath(); 849 | 850 | // Checks backup folder validness 851 | if (!backupsFolder) { 852 | return undefined; 853 | } 854 | 855 | return vscode.Uri.joinPath( 856 | backupsFolder, 857 | `${fileName} - ${this._currentDate()}.bak` 858 | ); 859 | } 860 | 861 | /** 862 | * Creates a backup uri path with the given filename. 863 | * 864 | * If the backup path cannot be determined, it returns ``undefined``. 865 | * @param fileName File name 866 | * @returns The formatted backup uri path 867 | */ 868 | processLoadOrderBackupFilePath(fileName: string) { 869 | const backupsFolder = this.determineLoadOrderBackupsPath(); 870 | 871 | // Checks backup folder validness 872 | if (!backupsFolder) { 873 | return undefined; 874 | } 875 | 876 | return vscode.Uri.joinPath( 877 | backupsFolder, 878 | `${fileName} - ${this._currentDate()}.bak` 879 | ); 880 | } 881 | 882 | /** 883 | * Gets the configuration value from the VS Code settings. 884 | * 885 | * If the key is not found it returns ``undefined``. 886 | * @param key Configuration key 887 | * @returns 888 | */ 889 | private _getVSCodeConfig(key: string): T | undefined { 890 | return vscode.workspace.getConfiguration('rgssScriptEditor').get(key); 891 | } 892 | 893 | /** 894 | * Formats the current date and returns it as a string. 895 | * @returns Formatted date. 896 | */ 897 | private _currentDate(): string { 898 | let date = new Date(); 899 | const day = date.getDate().toString().padStart(2, '0'); 900 | const month = (date.getMonth() + 1).toString().padStart(2, '0'); 901 | const year = date.getFullYear().toString(); 902 | const hour = date.getHours().toString().padStart(2, '0'); 903 | const minutes = date.getMinutes().toString().padStart(2, '0'); 904 | const seconds = date.getSeconds().toString().padStart(2, '0'); 905 | return `${year}.${month}.${day} - ${hour}.${minutes}.${seconds}`; 906 | } 907 | } 908 | -------------------------------------------------------------------------------- /src/modules/utils/fileutils.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as fs from 'fs'; 3 | 4 | /** 5 | * Base options. 6 | */ 7 | export type Options = { 8 | /** 9 | * Recursive flag. 10 | */ 11 | recursive?: boolean; 12 | }; 13 | 14 | /** 15 | * Read options. 16 | */ 17 | export type ReadOptions = { 18 | /** 19 | * Relative flag. 20 | * 21 | * Formats all entries to be relative of the given directory. 22 | */ 23 | relative?: boolean; 24 | } & Options; 25 | 26 | /** 27 | * Write options. 28 | */ 29 | export type WriteOptions = { 30 | /** 31 | * Overwrite flag. 32 | */ 33 | overwrite?: boolean; 34 | } & Options; 35 | 36 | /** 37 | * Checks if the given folder path is a directory or not. 38 | * @param folder Folder path 39 | * @returns Whether path is a directory. 40 | */ 41 | export function isFolder(folder: string): boolean { 42 | // Checks if path exists. 43 | if (!fs.existsSync(folder)) { 44 | return false; 45 | } 46 | 47 | // Checks if file is a directory. 48 | return fs.statSync(folder).isDirectory(); 49 | } 50 | 51 | /** 52 | * Checks if the given file path is a file or not. 53 | * @param file File path 54 | * @returns Whether path is a file. 55 | */ 56 | export function isFile(file: string): boolean { 57 | // Checks if path exists. 58 | if (!fs.existsSync(file)) { 59 | return false; 60 | } 61 | 62 | // Checks if file is actually a file. 63 | return fs.statSync(file).isFile(); 64 | } 65 | 66 | /** 67 | * Checks if the given file path is a Ruby script file or not. 68 | * @param file File path 69 | * @returns Whether path is a Ruby file. 70 | */ 71 | export function isRubyFile(file: string): boolean { 72 | // Checks if it is a file. 73 | if (!isFile(file)) { 74 | return false; 75 | } 76 | 77 | // Checks if file is a Ruby script. 78 | return path.extname(file).toLowerCase() === '.rb'; 79 | } 80 | 81 | /** 82 | * Checks if the given folder path is a directory or not. 83 | * 84 | * This function won't check for the folder existence. 85 | * @param folder Folder path 86 | * @returns Whether path is a directory. 87 | */ 88 | export function isFolderLike(folder: string): boolean { 89 | const baseName = path.basename(folder); 90 | return baseName.length > 0 && path.extname(baseName) !== '.rb'; 91 | } 92 | 93 | /** 94 | * Checks if the given file path is a Ruby script file or not. 95 | * 96 | * This function won't check for the file existence. 97 | * @param file File path 98 | * @returns Whether path is a Ruby file. 99 | */ 100 | export function isRubyFileLike(file: string): boolean { 101 | return path.extname(file).toLowerCase() === '.rb'; 102 | } 103 | 104 | /** 105 | * Creates a folder in the given path. 106 | * @param folderPath Path to the folder. 107 | * @param options Options. 108 | */ 109 | export function createFolder(folderPath: string, options?: WriteOptions) { 110 | if (!fs.existsSync(folderPath) || options?.overwrite) { 111 | fs.mkdirSync(folderPath, { recursive: options?.recursive }); 112 | } 113 | } 114 | 115 | /** 116 | * Copies the file located in ``source`` to ``destination``. 117 | * 118 | * If the file already exists it throws an error if ``overwrite`` flag is disabled. 119 | * 120 | * If ``recursive`` flag is enabled it will create the destination directory if it does not exists. 121 | * @param source Source file path 122 | * @param destination Destination file path 123 | * @param options Options. 124 | */ 125 | export function copyFile( 126 | source: string, 127 | destination: string, 128 | options?: WriteOptions 129 | ) { 130 | let destinationPath = path.dirname(destination); 131 | // Create directory if possible 132 | if (!fs.existsSync(destinationPath) && options?.recursive) { 133 | createFolder(destinationPath, options); 134 | } 135 | 136 | // Copy file 137 | fs.copyFileSync( 138 | source, 139 | destination, 140 | options?.overwrite ? undefined : fs.constants.COPYFILE_EXCL 141 | ); 142 | } 143 | 144 | /** 145 | * Reads all entries of the given directory specified by ``base``. 146 | * 147 | * Optionally, some options ({@link ReadOptions ``ReadOptions``}) can be given that changes the behavior of this function. 148 | * 149 | * A callback function can be given to handle the entries before returning them. 150 | * 151 | * If the given directory does not exists it raises an exception. 152 | * @param base Base directory 153 | * @param options Read options 154 | * @param filter Filter callback 155 | * @returns List of entries 156 | */ 157 | export function readDirectory( 158 | base: string, 159 | options?: ReadOptions, 160 | filter?: (entries: string[]) => string[] 161 | ): string[] { 162 | // Gets data (absolute paths) 163 | let entries = readDir(base, options?.recursive); 164 | 165 | // Process relative flag 166 | if (options?.relative) { 167 | entries = entries.map((entry) => { 168 | return path.relative(base, entry); 169 | }); 170 | } 171 | 172 | // Returns data 173 | return filter ? filter(entries) : entries; 174 | } 175 | 176 | /** 177 | * Reads the given directory. 178 | * 179 | * If ``recursive`` flag is enabled it will read all subfolders of the directory. 180 | * @param base Base directory 181 | * @param recursive Recursive flag 182 | * @returns List of entries 183 | */ 184 | function readDir(base: string, recursive?: boolean) { 185 | let entries: string[] = []; 186 | 187 | fs.readdirSync(base).forEach((entry) => { 188 | let fullPath = path.join(base, entry); 189 | 190 | // Inserts entry 191 | entries.push(fullPath); 192 | 193 | // Process recursiveness 194 | if (fs.statSync(fullPath).isDirectory() && recursive) { 195 | entries = entries.concat(...readDir(fullPath, recursive)); 196 | } 197 | }); 198 | 199 | return entries; 200 | } 201 | -------------------------------------------------------------------------------- /src/modules/utils/filewatcher.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | /** 4 | * File system watcher class. 5 | */ 6 | export class FileSystemWatcher { 7 | /** 8 | * File system watcher instance. 9 | */ 10 | private _watcher?: vscode.FileSystemWatcher; 11 | 12 | /** 13 | * File system watcher pattern. 14 | */ 15 | private _pattern?: vscode.RelativePattern; 16 | 17 | /** 18 | * Event fired when a file system entry is created. 19 | */ 20 | private _onDidCreateEmitter = new vscode.EventEmitter(); 21 | readonly onDidCreate: vscode.Event = 22 | this._onDidCreateEmitter.event; 23 | 24 | /** 25 | * Event fired when a file system entry is deleted. 26 | */ 27 | private _onDidDeleteEmitter = new vscode.EventEmitter(); 28 | readonly onDidDelete: vscode.Event = 29 | this._onDidDeleteEmitter.event; 30 | 31 | /** 32 | * Event fired when a file system entry is changed. 33 | */ 34 | private _onDidChangeEmitter = new vscode.EventEmitter(); 35 | readonly onDidChange: vscode.Event = 36 | this._onDidChangeEmitter.event; 37 | 38 | /** 39 | * Updates the scripts controller instance attributes. 40 | * @param config Configuration. 41 | */ 42 | async update(pattern: vscode.RelativePattern) { 43 | this._pattern = pattern; 44 | this._restart(); 45 | } 46 | 47 | /** 48 | * Disposes the file system watcher instance. 49 | */ 50 | async dispose() { 51 | this._watcher?.dispose(); 52 | this._watcher = undefined; 53 | } 54 | 55 | /** 56 | * Restarts this instance based on the current attributes. 57 | */ 58 | private _restart() { 59 | // Check pattern validness 60 | if (!this._pattern) { 61 | return; 62 | } 63 | 64 | // Disposes previous values 65 | this.dispose(); 66 | 67 | // Recreates the watcher with the current configuration 68 | this._watcher = vscode.workspace.createFileSystemWatcher(this._pattern); 69 | 70 | // Sets the watcher callbacks 71 | this._watcher.onDidCreate((uri: vscode.Uri) => { 72 | this._onDidCreateEmitter.fire(uri); 73 | }); 74 | this._watcher.onDidDelete((uri) => { 75 | this._onDidDeleteEmitter.fire(uri); 76 | }); 77 | this._watcher.onDidChange((uri) => { 78 | this._onDidChangeEmitter.fire(uri); 79 | }); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/modules/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as vscode from 'vscode'; 3 | import { Configuration } from './configuration'; 4 | 5 | /** 6 | * Extension logger class. 7 | */ 8 | class Logger { 9 | /** 10 | * Extension configuration instance. 11 | */ 12 | private _config?: Configuration; 13 | 14 | /** 15 | * VSCode log output channel. 16 | */ 17 | private _output: vscode.OutputChannel; 18 | 19 | /** 20 | * Constructor. 21 | */ 22 | constructor() { 23 | this._config = undefined; 24 | this._output = vscode.window.createOutputChannel( 25 | 'RGSS Script Editor', 26 | 'log' 27 | ); 28 | } 29 | 30 | /** 31 | * Updates the logger with the given configuration instance. 32 | * 33 | * A valid instance is needed for the logger to log information to the log file. 34 | * @param config Extension configuration instance. 35 | */ 36 | update(config: Configuration) { 37 | this._config = config; 38 | // Clears current output channel contents 39 | this._output.clear(); 40 | // Deletes old log file 41 | if (this._config.configLogFile()) { 42 | this.deleteLogFile(); 43 | } 44 | } 45 | 46 | /** 47 | * Deletes the log file of to this logger instance if it exists. 48 | */ 49 | deleteLogFile(): void { 50 | let logFilePath = this._config?.determineLogFilePath(); 51 | if (logFilePath && fs.existsSync(logFilePath.fsPath)) { 52 | fs.unlinkSync(logFilePath.fsPath); 53 | } 54 | } 55 | 56 | /** 57 | * Disposes this logger instance. 58 | */ 59 | async dispose() { 60 | this._output.dispose(); 61 | } 62 | 63 | /** 64 | * Logs the given message. 65 | * 66 | * A new line character is automatically concatenated. 67 | * @param message Log message. 68 | * @param errorConsole Console error output flag. 69 | */ 70 | log(message: string, errorConsole: boolean = false): void { 71 | let msg = '[RGSS Script Editor] ' + message.concat('\n'); 72 | // Logging to console enabled 73 | if (this._config?.configLogConsole()) { 74 | // Write console message (dev console) 75 | if (errorConsole) { 76 | console.error(msg); 77 | } else { 78 | console.log(msg); 79 | } 80 | this._output.append(msg); 81 | } 82 | // Logging to file enabled 83 | if (this._config?.configLogFile()) { 84 | let logFile = this._config.determineLogFilePath(); 85 | let logFileDir = this._config.determineLogFilePath({ 86 | removeFilePart: true, 87 | }); 88 | 89 | // Process logging operation 90 | if (!logFile || !logFileDir) { 91 | return; 92 | } 93 | // Creates the directory if it does not exists 94 | if (!fs.existsSync(logFileDir.fsPath)) { 95 | fs.mkdirSync(logFileDir.fsPath, { recursive: true }); 96 | } 97 | // Writes the to log file 98 | fs.writeFileSync(logFile.fsPath, msg, { flag: 'a' }); 99 | } 100 | } 101 | 102 | /** 103 | * Logs the given message with an INFO label 104 | * 105 | * A new line character is automatically concatenated 106 | * @param message Message 107 | */ 108 | logInfo(message: string): void { 109 | this.log('INFO: '.concat(message)); 110 | } 111 | 112 | /** 113 | * Logs the given message with a WARNING label 114 | * 115 | * A new line character is automatically concatenated 116 | * @param message Message 117 | */ 118 | logWarning(message: string): void { 119 | this.log('WARNING: '.concat(message)); 120 | } 121 | 122 | /** 123 | * Logs the given message with an ERROR label 124 | * 125 | * A new line character is automatically concatenated 126 | * @param message Message 127 | */ 128 | logError(message: string): void { 129 | this.log('ERROR: '.concat(message), true); 130 | } 131 | 132 | /** 133 | * Logs the given unknown error with an ERROR label 134 | * 135 | * A new line character is automatically concatenated 136 | * @param message Message 137 | */ 138 | logErrorUnknown(error: unknown): void { 139 | if (typeof error === 'string') { 140 | this.logError(error); 141 | } else if (error instanceof Error) { 142 | this.logError(`${error.stack}`); 143 | } 144 | } 145 | } 146 | 147 | export let logger = new Logger(); 148 | -------------------------------------------------------------------------------- /src/modules/utils/strings.ts: -------------------------------------------------------------------------------- 1 | import { l10n } from 'vscode'; 2 | 3 | export const CLOSE = l10n.t('Close'); 4 | 5 | export const QUICK_START_INFO = l10n.t( 6 | 'Several RPG Maker folders were detected in the current workspace, choose one to set it as active.' 7 | ); 8 | 9 | export const SCRIPTS_NOT_EXTRACTED = l10n.t( 10 | 'Some scripts were detected inside the RPG Maker scripts file, you should extract them now.' 11 | ); 12 | 13 | export const SET_PROJECT_PLACEHOLDER = l10n.t( 14 | 'Choose the RPG Maker active project folder' 15 | ); 16 | 17 | export const SET_PROJECT_SUCCESS = l10n.t( 18 | '"{0}" workspace folder opened successfully!' 19 | ); 20 | 21 | export const SET_PROJECT_FAIL = l10n.t( 22 | 'Failed to open the folder, a valid RGSS version was not detected.' 23 | ); 24 | 25 | export const ERROR_GENERIC = l10n.t( 26 | 'Something went wrong! Please check RGSS Script Editor output channel for more information.' 27 | ); 28 | 29 | export const SCRIPT_LOADER_ERROR = l10n.t( 30 | "'Cannot create script loader because RPG Maker bundle file still has valid scripts inside of it!'" 31 | ); 32 | 33 | export const SCRIPT_LOADER_SUCCESS = l10n.t( 34 | 'The script loader was created successfully!' 35 | ); 36 | 37 | export const BUNDLE_BACKUP_SUCCESS = l10n.t( 38 | 'The backup bundle file was created successfully!' 39 | ); 40 | 41 | export const LOAD_ORDER_BACKUP_SUCCESS = l10n.t('Load order backup created!'); 42 | 43 | export const BUNDLE_CREATE_SUCCESS = l10n.t( 44 | 'The bundle file was created successfully!' 45 | ); 46 | 47 | export const BUNDLE_CREATE_SELECTED_INVALID = l10n.t( 48 | `You must select at least one section on the tree view to create the bundle file!` 49 | ); 50 | 51 | export const BUNDLE_CREATE_SELECTED_SUCCESS = l10n.t( 52 | 'The bundle file was created successfully!' 53 | ); 54 | 55 | export const COMPILE_SCRIPT_SUCCESS = l10n.t( 56 | 'Scripts were compiled successfully!' 57 | ); 58 | 59 | export const PROCESS_EXCEPTION_NO_REPORT = l10n.t( 60 | 'No exception was reported in the last game session.' 61 | ); 62 | 63 | export const PROCESS_EXCEPTION_WARNING = l10n.t( 64 | 'An exception was reported in the last game session.' 65 | ); 66 | 67 | export const PROCESS_EXCEPTION_OPT_PEEK = l10n.t('Peek Backtrace'); 68 | 69 | export const CREATE_TYPE_TITLE = l10n.t('Create a new section at: {0}'); 70 | 71 | export const CREATE_TYPE_PLACEHOLDER = l10n.t('Choose new section type...'); 72 | 73 | export const CREATE_TYPE_OPT_SCRIPT = l10n.t('Create Script'); 74 | 75 | export const CREATE_TYPE_OPT_FOLDER = l10n.t('Create Folder'); 76 | 77 | export const CREATE_TYPE_OPT_SEPARATOR = l10n.t('Create Separator'); 78 | 79 | export const CREATE_NAME_TITLE = l10n.t('Create a new section at: {0}'); 80 | 81 | export const CREATE_NAME_PLACEHOLDER = l10n.t( 82 | 'Type a name for the new section...' 83 | ); 84 | 85 | export const DELETE_TITLE = l10n.t('Deleting: {0}'); 86 | 87 | export const DELETE_PLACEHOLDER = l10n.t( 88 | 'Are you sure you want to delete the selected sections? (This is irreversible)' 89 | ); 90 | 91 | export const DELETE_OPT_DELETE = l10n.t( 92 | 'Delete section (This is irreversible)' 93 | ); 94 | 95 | export const DELETE_OPT_CANCEL = l10n.t('Cancel section deletion'); 96 | 97 | export const RENAME_TITLE = l10n.t('Renaming: {0}'); 98 | 99 | export const RENAME_PLACEHOLDER = l10n.t('Type a new name for this section...'); 100 | 101 | export const EDITOR_MODE_MERGE = l10n.t('Merge'); 102 | 103 | export const EDITOR_MODE_MOVE = l10n.t('Move'); 104 | 105 | export const EDITOR_MODE_UNKNOWN = l10n.t('Unknown'); 106 | 107 | export const CHOOSE_EDITOR_MODE_TITLE = l10n.t('Current Editor Mode: {0}'); 108 | 109 | export const CHOOSE_EDITOR_MODE_PLACEHOLDER = l10n.t( 110 | 'Choose the editor mode...' 111 | ); 112 | 113 | export const VALIDATE_INPUT_NAME = l10n.t( 114 | 'Input contains invalid characters or words! ({0})' 115 | ); 116 | 117 | export const VALIDATE_INPUT_PATH = l10n.t( 118 | 'An editor section already exists with the given input!' 119 | ); 120 | 121 | export const UI_SET_PROJECT_NAME = l10n.t( 122 | 'RGSS Script Editor: Set Project Folder' 123 | ); 124 | 125 | export const UI_SET_PROJECT_TEXT = l10n.t('Choose RPG Maker Project Folder'); 126 | 127 | export const UI_SET_PROJECT_TOOLTIP = l10n.t( 128 | 'Choose a RPG Maker project folder from the current workspace to activate it' 129 | ); 130 | 131 | export const UI_PROJECT_FOLDER_NAME = l10n.t( 132 | 'RGSS Script Editor: Active Project Folder' 133 | ); 134 | 135 | export const UI_PROJECT_FOLDER_TEXT = l10n.t('RPG Maker Active Project: {0}'); 136 | 137 | export const UI_PROJECT_FOLDER_TOOLTIP = l10n.t( 138 | 'Opens the current active RPG Maker project folder' 139 | ); 140 | 141 | export const UI_RUN_GAME_NAME = l10n.t('RGSS Script Editor: Run Game'); 142 | 143 | export const UI_RUN_GAME_TEXT = l10n.t('Run Game'); 144 | 145 | export const UI_RUN_GAME_TOOLTIP = l10n.t('Runs the game executable'); 146 | 147 | export const UI_EXTRACT_NAME = l10n.t('RGSS Script Editor: Extract Scripts'); 148 | 149 | export const UI_EXTRACT_TEXT = l10n.t('Extract Scripts'); 150 | 151 | export const UI_EXTRACT_TOOLTIP = l10n.t( 152 | 'Extracts all scripts from the bundled RPG Maker scripts file' 153 | ); 154 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2022" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension 2 | 3 | ## What's in the folder 4 | 5 | * This folder contains all of the files necessary for your extension. 6 | * `package.json` - this is the manifest file in which you declare your extension and command. 7 | * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. 8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command. 9 | * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. 10 | * We pass the function containing the implementation of the command as the second parameter to `registerCommand`. 11 | 12 | ## Get up and running straight away 13 | 14 | * Press `F5` to open a new window with your extension loaded. 15 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`. 16 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension. 17 | * Find output from your extension in the debug console. 18 | 19 | ## Make changes 20 | 21 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`. 22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 23 | 24 | ## Explore the API 25 | 26 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. 27 | 28 | ## Run tests 29 | 30 | * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`. 31 | * Press `F5` to run the tests in a new window with your extension loaded. 32 | * See the output of the test result in the debug console. 33 | * Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder. 34 | * The provided test runner will only consider files matching the name pattern `**.test.ts`. 35 | * You can create folders inside the `test` folder to structure your tests any way you want. 36 | 37 | ## Go further 38 | 39 | * [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns. 40 | * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension). 41 | * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. 42 | * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration). 43 | --------------------------------------------------------------------------------