Devtools Options Yaml Settings and Features

Author

Reads 1.2K

A Blue "Yes" Button and a Red "No" Button
Credit: pexels.com, A Blue "Yes" Button and a Red "No" Button

The options.yaml file in Devtools is a configuration file that allows you to customize various settings and features.

You can use the options.yaml file to configure settings such as the default port for the Devtools server, the maximum number of open files, and the logging level.

One of the key features of the options.yaml file is the ability to configure the logging level, which can be set to debug, info, warning, error, or fatal.

The options.yaml file also allows you to configure the maximum number of open files, which can help prevent file descriptor leaks.

The default port for the Devtools server can be configured using the options.yaml file, allowing you to run the server on a custom port.

Build and Run

As you start building your application, it's essential to understand the various options available to you. dart.buildRunnerAdditionalArgs is a crucial setting that allows you to pass additional arguments to the build_runner when building, watching, or serving your application.

Credit: youtube.com, DevTools Extensions – Flutter Build Show

You can use this setting to customize the build process to suit your needs. For example, you can use it to specify additional flags or options for the build_runner.

To get started, simply add the dart.buildRunnerAdditionalArgs setting to your options.yaml file. This will enable you to pass additional arguments to the build_runner during the build process.

The options you can pass with dart.buildRunnerAdditionalArgs are numerous, and you can experiment with different combinations to find the one that works best for you.

Yaml and Config

You can write the build config file using either YAML or JSON syntax. YAML is a popular choice for its readability and simplicity.

A build config file has a specific structure, modeled after the Cloud Build API's Build resource. This structure allows you to define different sections for various tasks you want Cloud Build to execute.

The YAML syntax is particularly useful for defining sections like pool, which sets the value of a private pool to run the build. For example, you can set the value of this field to the resource name of the private pool.

Yaml

Credit: youtube.com, YAML Tutorial | Learn YAML in 10 Minutes

YAML is a powerful syntax for defining the structure of a build config file. You can use YAML to write a build config file that Cloud Build can understand.

Each section of the build config file defines a part of the task you want Cloud Build to execute. This includes setting the value of the "pool" field to the resource name of the private pool to run the build.

You can run a build on a private pool by setting the "pool" field to the resource name of the private pool. For instructions on how to do this, see Running builds in a private pool.

The YAML syntax is a great choice for writing build config files, especially if you're submitting build requests using third-party HTTP tools like curl. This is because the JSON syntax is required for third-party HTTP tools.

Artifact Path

Artifact Path is a workspace mapping that allows you to specify a non-default artifact path to use within the workspace for both deployments and workflow runs.

By default, Databricks CLI uses the default path of ${workspace.root}/artifacts, which uses substitutions.

The artifact_path mapping does not support Databricks File System (DBFS) paths.

You can define, combine, and override the settings for artifacts in bundles as described in Define artifact settings dynamically in Databricks Asset Bundles.

Substitutions

Credit: youtube.com, Working with YAML Files in Python

Substitutions are a powerful tool in YAML and config files, allowing you to substitute specific variables at build time.

You can automatically map all substitutions and make them available as environment variables in a single step by setting automapSubstitutions to true.

Substitutions are helpful for variables whose value isn't known until build time, or to re-use an existing build request with different variable values.

By default, the build returns an error if there's a missing substitution variable or a missing substitution, but you can use the ALLOW_LOOSE option to skip this check.

The ALLOW_LOOSE option is particularly useful when you want to print "hello world" with substitutions, as shown in an example snippet, which sets the ALLOW_LOOSE substitution option to skip the error check.

Queue TTL

Queue TTL is a field that specifies the amount of time a build can be queued. If a build is in the queue for longer than the value set in queueTtl, the build expires and the build status is set to EXPIRED.

Credit: youtube.com, YAML and YAMLScript - Ingy döt Net, YAML LLC

The default value for queueTtl is 3600s, which is equivalent to 1 hour. This means that if you don't specify a value for queueTtl, the build will expire after 1 hour.

You can specify a custom value for queueTtl in seconds, with up to nine fractional digits, terminated by 's'. For example, 3.5s is a valid value for queueTtl.

The queueTtl starts ticking from the createTime, which is the time the build is requested. This means that the clock starts ticking as soon as you submit the build request.

In some cases, you might want to set a shorter queueTtl, like 10s, as shown in the snippet. This will make the build expire much faster, unless the build starts by then.

It's worth noting that queueTtl and timeout are two separate fields, and they start ticking at different times. QueueTtl starts ticking at createTime, while timeout starts ticking at startTime. This means that you can set a shorter queueTtl without affecting the timeout value.

Options

Credit: youtube.com, YAML Tutorial | Learn YAML in 10 Minutes

Options are a crucial part of Yaml and Config, and understanding them can make a huge difference in how you work with your code.

Some options are boolean, like `dart.addSdkToTerminalPath`, which defaults to true. It determines whether to add your selected Dart/Flutter SDK path to the PATH environment variable for the embedded terminal.

Switching SDKs via `dart.sdkPaths` or `dart.flutterSdkPaths` requires careful consideration of this option, as it affects how commands run from the terminal are executed.

Documentation

Documentation is a crucial aspect of any programming project. It helps others understand the code and makes it easier to maintain.

You can control the level of documentation shown in Hovers and Code Completion details using the "dart.documentation" option. This option can be set to "full", "summary", or "none".

The "full" option shows the full documentation, while "summary" shows a short summary. The "none" option doesn't show any documentation at all.

Here are the specific options you can use for "dart.documentation":

  • full - Show full documentation.
  • summary - Show short documentation summary.
  • none - Do not show documentation.

The default setting for "dart.documentation" is "full" when running locally and "none" in remote workspaces. However, this setting is only supported for Dart SDKs after v2.18.

Dev Tools Options

Credit: youtube.com, chrome developer tools tutorial

You can configure various Dev Tools options in your options.yaml file to tailor your development experience.

The devToolsBrowser option allows you to choose whether to launch external DevTools windows using Chrome or the system default browser. It defaults to "chrome".

You can also control whether to automatically open DevTools at the start of a debug session with the openDevTools option. This option has three possible values: "never", "flutter", or "always". If you choose "never", DevTools won't launch automatically. If you choose "flutter", DevTools will launch for Flutter projects only. If you choose "always", DevTools will launch for any debug session.

Here are the possible values for the openDevTools option:

  • never - Do not automatically launch DevTools when starting a debug session.
  • flutter - Automatically launch DevTools when starting a Flutter debug session.
  • always - Automatically launch DevTools when starting any debug session.

The shareDevToolsWithFlutter option is enabled by default and allows you to share the spawned server with flutter run for Flutter workspaces.

Allow Failure

Allow Failure is a feature that lets you control how a build behaves when a step fails. If you set allowFailure to true, the build will succeed as long as all other steps succeed.

Credit: youtube.com, How to fix 'DevTools failed to load SourceMap' 'status code 404, net::ERR_UNKNOWN_URL_SCHEME' issue.

This can be useful in certain situations, such as when you're testing a build and you want it to complete even if one step fails. The following code snippet allows the build to succeed when the first step fails:

In a build step, if you set allowFailure to true and the build step fails, the build succeeds as long as all other build steps in that build succeed.

Allow Exit Codes

You can specify that a build step failure can be ignored when that step returns a particular exit code using the allowExitCodes field.

This field is particularly useful when working with Linux, where a common exit code is 1. You can also define your own exit codes in your scripts.

The allowExitCodes field accepts numbers up to a maximum of 255, giving you a wide range of options for customizing your build process.

If a build step fails with an exit code matching the value you've provided in allowExitCodes, Cloud Build will allow this build step to fail without failing your entire build.

However, if the build step fails and produces another exit code that doesn't match the value you've specified, the overall build will fail.

You can define multiple exit codes in the allowExitCodes field, allowing you to customize the build process to suit your specific needs.

Dev Tools Browser

Credit: youtube.com, 21+ Browser Dev Tools & Tips You Need To Know

When working with Dev Tools, you'll need to decide how to launch external DevTools windows. This is where the Dev Tools browser comes in. You can choose to launch them in Chrome or the system default browser.

By default, Dev Tools will launch in Chrome. However, you can change this to use the system default browser if you prefer.

Here are your options for the Dev Tools browser:

Keep in mind that you can always change this setting to suit your needs.

Debug Backend Protocol

Debugging is a crucial part of the development process, and having the right tools can make all the difference.

The Dart Debug Extension backend protocol is an important setting that can impact your debugging experience. It determines how the backend service and injected client communicate with each other.

You can choose between two options: "sse" or "ws". The default setting is "ws", which can improve performance but may fail when connecting through some proxy servers.

Here are the two options in more detail:

  • sse - Server-Sent Events.
  • ws - WebSockets.

If you're experiencing issues with proxy servers, you may want to consider using the "sse" protocol instead.

Error Recovery Prompt

Credit: youtube.com, Find and fix problems with the Chrome DevTools Issues tab

You can configure your Dev Tools to prompt you before running your project if there are errors. This feature is called dart.promptToRunIfErrors.

The default setting for this feature is True, which means you'll be prompted by default. However, you can change this setting to suit your needs.

Test scripts are excluded from the error check unless they're the script being run. This ensures you can test your project without being interrupted by unnecessary prompts.

MaxCompletionItems

The maximum number of completion items to return from a code completion request is determined by the dart.maxCompletionItems setting. Lower numbers may improve performance.

This setting affects the LSP (Language Server Protocol) in remote workspaces, which means you can expect better performance in these environments. Only LSP for Dart SDK versions greater than 2.17 are impacted by this setting.

UseLegacyDebugAdapters

The dart.useLegacyDebugAdapters setting is a legacy option that's not recommended since Dart v3.4.

Setting this value to true will force the use of legacy debug adapters, even if the new debug adapters are available in the current Dart/Flutter SDKs.

Legacy debug adapters are only applicable when using the legacy debug adapters, making this setting redundant in modern setups.

Leaving this setting as null will allow the extension to decide which debug adapters to use, depending on the SDK version and rollout progress.

InsertArgumentPlaceholders

Woman in focus working on software development remotely on laptop indoors.
Credit: pexels.com, Woman in focus working on software development remotely on laptop indoors.

InsertArgumentPlaceholders is a feature that determines whether to insert argument placeholders during code completions.

It's enabled by default, which means you'll see argument placeholders unless you've made a change to this setting.

This feature is automatically disabled when you enable CompletionCommitCharacters.

About Profiles

A profile in dev tools is made up of targets, and a default target that's specified.

Each target is unique and includes the type of warehouse you're connecting to, as well as the credentials needed to connect.

The credentials required can vary across different warehouses, but you can find sample profiles for each supported warehouse in the relevant section.

You may need to surround your password in quotes if it contains special characters, so be sure to check the details on that.

A profile can be used to connect to multiple warehouses with different credentials, making it a convenient and efficient way to manage your connections.

Dev Tools Features

The dev tools features in options.yaml are quite impressive. One of the most useful features is the ability to enable or disable the debug mode, which can be done by setting the `debug` field to `true` or `false`.

Credit: youtube.com, Chrome Dev Tools 101: A Beginner's Guide to Using Dev Tools

This feature is useful for developers who want to troubleshoot issues in their application. For instance, setting `debug` to `true` can help you identify issues with your database connections.

The `logging` feature in options.yaml also deserves a mention. It allows you to configure the logging level and format, which can be useful for monitoring and debugging your application.

Dev Tools Debug Toolbar Buttons

The Dev Tools Debug Toolbar Buttons are a useful feature that allows you to show or hide the buttons in the floating Debug toolbar.

By default, the Dev Tools show the DevTools buttons in the floating Debug toolbar, as the dart.showDevToolsDebugToolBarButtons setting is set to true.

This feature is particularly helpful when you need to quickly access the Debug toolbar without cluttering your screen with unnecessary buttons.

Hot Reload Progress

Hot Reload Progress is a feature that allows you to see the progress of Hot Restart and Hot Reload.

You can choose how to display this progress by setting the dart.hotReloadProgress option to either "notification" or "statusBar".

Credit: youtube.com, .NET 6 Hot Reload Controversy Explained

If you set it to "notification", the progress will be shown in a toast notification.

Alternatively, if you set it to "statusBar", the progress will only be shown in the status bar.

Here's a quick summary of the options:

Test Invocation Mode

Test Invocation Mode is a crucial feature in dev tools that determines how tests are identified and run.

There are two options: "name" and "line".

The default option is "name", which is compatible with older versions of package:test.

The "line" option prefers to run tests by their line numbers when available and falls back to "name" only if the line number is unavailable.

Understanding Threads

Threads are a crucial aspect of dbt, as they help minimize the run time of your project by allowing it to work on multiple paths through the graph at once. The number of threads dbt creates represents the maximum number of paths it may work on simultaneously.

The default value for threads in user profiles is 4 threads. This means that if you don't specify a different number, dbt will use 4 threads to run your project.

Debugging and Analysis

Credit: youtube.com, Debugging JavaScript - Chrome DevTools 101

Debugging and Analysis is a crucial part of the development process.

You can enable stepping into Dart SDK libraries while debugging by setting dart.debugSdkLibraries to true.

This allows you to debug and analyze your code more effectively, which can save you a lot of time and effort in the long run.

For example, if you're stuck on a bug and can't figure out what's going on, being able to step into Dart SDK libraries can be a huge help.

Debug External Libraries

Debug External Libraries is a crucial aspect of the debugging process. It allows you to step into external pub package libraries while debugging.

The default setting for this is false, meaning external libraries are not marked as debuggable by default. This can make it difficult to diagnose issues within these libraries.

To enable stepping into external libraries, you can set dart.debugExternalPackageLibraries to true. This will allow you to debug external libraries, including package:flutter.

Debug SDK Libraries

Two professionals collaborating on software development in a modern indoor setting.
Credit: pexels.com, Two professionals collaborating on software development in a modern indoor setting.

Debugging Dart SDK libraries can be a game-changer for developers, allowing you to step into them while debugging.

The dart.debugSdkLibraries setting defaults to false, which means you need to explicitly enable it to mark Dart SDK libraries as debuggable.

By setting dart.debugSdkLibraries to true, you can gain a deeper understanding of how your code interacts with the Dart SDK, making it easier to identify and fix issues.

Debug View Evaluation

Debug View Evaluation is a crucial aspect of debugging and analysis. It helps you understand the state of your application by rendering objects in debug views.

The dart.evaluateToStringInDebugViews setting determines whether to call toString() on objects in debug views. This setting is enabled by default, which means you'll see a string representation of objects in these views.

This feature is only applied to views of 100 or fewer values for performance reasons. If you have a large number of values, you might want to consider disabling this setting to improve performance.

Testing and Environment

Credit: youtube.com, Chrome Dev Tools Overview for Web Testing

In Dart, environment variables can be added to all processes spawned by the Dart and Flutter extensions through the dart.env variable. This allows for custom settings to be applied across the board.

The default value for dart.env is an empty object, denoted by the curly brackets {}.

Env

Env is a crucial aspect of testing and environment, especially when working with Dart and Flutter.

The Dart.env variable is used to add additional environment variables to all Dart and Flutter processes spawned by the Dart and Flutter extensions.

By default, Dart.env is set to an empty object.

You can use this variable to set specific environment variables that will be applied across all your Dart and Flutter projects.

Test Log File

When running unit tests from VS Code, it's essential to have a clear understanding of how to manage and diagnose issues with test executions. The dart.flutterTestLogFile setting is crucial in this regard.

This setting allows you to specify a path to a log file for flutter test. The log file is used to capture and store information about unit test executions, which can be helpful for troubleshooting purposes.

Credit: youtube.com, How to Test Logging in Java

You can insert dynamic values into the log file name using specific placeholders. The ${name} placeholder inserts the Debug Session name, preventing concurrent debug sessions from overwriting each other's logs.

Another useful placeholder is ${workspaceName}, which inserts the name of the current workspace into the file path. This helps keep log files organized by workspace.

Experimental Handlers

Experimental Handlers are available through DTD, but they're still in the experimental stage, which means they might not be fully stable or finished yet.

To enable these handlers, you can set the dart.experimentalDtdHandlers option to true in your options.yaml file. This setting relies on DTD being supported and enabled for the analysis server, and you'll need to restart your IDE for the changes to take effect.

The experimental handlers are passed to the analysis server in the connectToDtd request, so make sure DTD is enabled for the analysis server.

Rosemary Boyer

Writer

Rosemary Boyer is a skilled writer with a passion for crafting engaging and informative content. With a focus on technical and educational topics, she has established herself as a reliable voice in the industry. Her writing has been featured in a variety of publications, covering subjects such as CSS Precedence, where she breaks down complex concepts into clear and concise language.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.