Skip to content

stan-at-work/remove-dart-error-warning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remove Dart Error/Warning

The Remove Dart Error/Warning extension for Visual Studio Code streamlines your Dart development workflow by automatically removing statements that cause errors or warnings in your code.


Features

  • Automated Cleanup: Scans your Dart files and removes lines with statements that have associated errors or warnings, helping to maintain clean and error-free code.

  • User-Friendly Commands: Easily accessible through the command palette or context menu for quick integration into your development process.


How to Use

Gif how to use the extension

  1. Using Command Palette:

    • Press Ctrl + Shift + P (or Cmd + Shift + P on macOS).

    • Type the desired command and select it when it appears:

      • Remove Dart Error/Warning

      • Remove Dart Errors Only

      • Remove Dart Warnings Only

  2. Using Context Menu:

    • Right-click within the code editor.

    • Select the desired command from the context menu:

      • Remove Dart Error/Warning

      • Remove Dart Errors Only

      • Remove Dart Warnings Only


Note: The extension uses the following regular expressions to identify and remove lines:

  1. For Import, Export, Part, and Part of Statements:

    ^(import|export|part|part of)\s

    This regex matches lines that are import, export, part, or part of statements.

  2. For Variable Declarations Starting with const, final, var, or late:

    ^\s*(const|final|var|late)\s+[\w<>,\s]+\s+\w*\s*(=.*)?\s*;$

    This regex matches lines that are variable declarations starting with const, final, var, or late.

These regular expressions are used to identify lines that should be removed based on their content and associated diagnostics.


Commands

The extension provides the following commands for flexibility:

  • Remove Dart Error/Warning: Removes all statements with errors or warnings.

  • Remove Dart Errors Only: Removes only the statements with errors.

  • Remove Dart Warnings Only: Removes only the statements with warnings.


Installation

To install the extension, visit the Visual Studio Marketplace and click 'Install'.


Contributing

Contributions are welcome! If you encounter issues or have suggestions for improvements, please visit the GitHub repository to report them or submit pull requests.


License

This project is licensed under the MIT License. See the LICENSE file for details.