Skip to main content

VS Code Extension

DCM VS Code extension is responsible for starting the analysis process and displaying analysis errors.

To download the extension, view the extension page on VS Code Marketplace or simply search DCM in the VS Code extensions panel.

Extension capabilities

All the errors calculated by the analysis process will be displayed in the opened files and in the "Problems view".

Quick fixes are also available, simply call the quick fix menu on the issue in the opened file.

You can quickly fix all fixable DCM rule issues with "DCM: Fix All Auto-fixable Problems" IDE command or via a shortcut ⌘ + Shift + S.

To apply fixes on save, modify the settings.json to the following:

.vscode/settings.json
{
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.dcm.fixAll": true
}
}

Assists

Wrap with ...

Extract to a new file

Analysis options files

If analysis_options.yaml file is open, the extension will mark all rules that support additional config with ⚙️ icon.

You can also call code action menu on each rule to quickly change its severity, disable it or open the rule documentation.

Analysis options code actions preview

Custom analysis options files

Aside from the regular analysis_option.yaml file, you can add a custom config file that matches one of the given patterns

  • starts with analysis_options (e.g. analysis_options.1.1.0.yaml)
  • starts with dcm (e.g. dcm_config.yaml or dcm.yaml)
  • placed inside a folder called dcm (e.g. dcm/config.yaml)

If such a file is referenced by any analysis_option.yaml file, DCM will correctly update configuration changes, validate rule names and display a configuration icon (⚙️) for configurable rules.

However, unlike for regular analysis_options.yaml files, code actions are not available.

Available commands

  1. DCM > Restart Analysis server
  2. DCM > Activate License key
  3. DCM > Share Feedback
  4. DCM > Capture All Logs
  5. DCM > Open Extension Log
  6. DCM > Fix All Auto-fixable Problems
  7. DCM > Format Current File

Available configuration

  1. Dart SDK path - is detected automatically if listed in PATH, but can be set up explicitly, if another version of the SDK should be used. FVM is also supported, if the project has a .fvm/flutter_sdk symlink - it will be used by the extension as well.
  2. DCM executable path - is detected automatically if listed in PATH, but can be set up explicitly.

Inherited configuration

The following configuration gets picked up if set for the Dart extension

  1. "dart.analysisExcludedFolders"
  2. "dart.onlyAnalyzeProjectsWithOpenFiles"

Ensuring the entire team installs the IDE extension

To ensure that your entire team installs the DCM VS Code extension, configure the "Workspace recommended extensions".

extensions.json
{
"recommendations": ["dcmdev.dcm-vscode-extension"]
}

Enabling inline diagnostics

To have diagnostics appear as text at the end of the line, consider installing an additional IDE extension (for example, Error Lens).

warning

Make sure the installed third-party extension is not malicious. We are not liable for any damage caused by third-party extensions.

Changelog

See the changelog.