The initial release of Wider aims to fulfill the basic requirements set forth by the project's creator. However, in addition to maintenance, future releases will be implemented as the need for new functionalities arises. Please feel free to request additional features that you think would complement the package effectively.
The features introduced in this package can individually be enabled / disabled through Wider's settings menu. The current functionalities of Wider are as follows;
Simple Ternary is the one that we know best. Entering colon (
Nested Ternary is about narowing multiple but dependent conditions into a single resolution. Such as in pseudo code
Switching Ternary is similar to the
Even if the comma-first functionality is enabled from the settings, it will only be effective if a space is placed after the left curly brace, left paranthesis or square bracket. Wider then auto-adopts a comma-first layout for object/array structures when a comma is entered at the end of the line. It's important to know that the Auto Closing Brackets option of the VSCode editor should be active, and you should be typing between the brackets. Also, when activated, Wider will attempt to set the Auto Closing Brackets option to
When the comma operator (,) is used for sequencing expressions or to separate function arguments. The comma-first layout scheme enhances the readability of the code especially with ternary based conditionals or with stacked method chains. In function arguments you may still benefit from this functionality if your arguments are long or expressions by themselves.
If a space is placed right after the opening left bracket, Wider automatically adopts the comma-first layout mode for expression sequencing. This takes effect when a comma is added at the end of the line. It's important to note that the Auto Closing Brackets option of the VSCode editor should be active and you should be typing between the brackets. Also note that when activated, Wider will attempt to set the Auto Closing Brackets option in the VSCode editor settings to
Starting with version 0.2.0, an experimental feature has been incorporated with the purpose of transforming a selected object or array structure into a broader comma-first layout. It is recommended that the selection closely encompasses the object or array intended for conversion. Should the selection extend to extraneous portions of your code, the algorithm's eagerness for conversion may result in unintended alterations. Also as of current version all comments in the selection are removed. This is a backlog and will be fixed.
Prior to implementation, testing and cautious usage is advised to avoid unexpected changes in your codebase.
Wherever a classical function declaration is on the line, its body gets indented 2 spaces relative to the start of the "function" keyword. This method of indentation isolates the function clearly from the rest of the code, avoiding the need to search for closing curly brackets. The usefulness of Deep Indented Functions is particularly evident when classically defined functions are used as callbacks or within Comma-First Expression Sequencing.
Wider has no dependencies.
By default, the aforementioned features are enabled, but you have the flexibility to disable them individually through the settings menu, and the changes will take effect immediately.
Nothing so far. Feel free to register encountered issues at the project repo.
Things to Remember
See the CHANGELOG file for details.
This project is licensed under the MIT License - see the LICENSE file for details.