A prebuilt Dart SDK is available for IDE consumption at: third_party/dart/tools/sdks/dart-sdk/
.
Download and install Visual Studio Code
[optional] Setup VS Code to launch from the command line
For Macs: To allow running VS Code from the terminal using the code
command, follow the instructions here
For Linux and Windows: This should already be done as part of the installation
Install the following extensions:
Here are some helpful user settings for Dart. Open your user settings (Ctrl+,), click the ‘{}’ icon in the top left corner and add:
{ // Auto-formats your files when you save "editor.formatOnSave": true, // Don't run pub with fuchsia. "dart.runPubGetOnPubspecChanges": false, // Settings only when working in Dart "[dart]": { // Adds a ruler at 80 characters "editor.rulers": [ 80 ], // Makes the tab size 2 spaces "editor.tabSize": 2, }, }
Settings > Plugins
then searching for Dart language support.Settings > Languages & Frameworks > Dart
byIf you find that the IDE is unable to find imports (red squigglies) that are already correctly in your BUILD.gn dependencies, this is usually a sign that Dart analysis is not working properly in your IDE.
When this happens, try the following:
E.g. only open /topaz/shell/ermine
instead of /topaz
. The analyzer can have issues with really large source trees.
.packages
and pubspec.lock
files in your project (if present)."dart.runPubGetOnPubspecChanges": false,
is present in your VSCode preferences to prevent the files from reappearing whenever a pubspec.yaml
file is edited.Delete /out
from your Fuchsia directory and rebuild. Dart FIDL bindings are build-generated and may be absent.
Any Dart code from packages not included in your build will not be available to the analyzer, so ensure your build configuration (fx set
) includes all the packages you need (the --with
flag can be helpful.)
Manually reloading the analyzer is often needed after modifying FIDLs.
This also restarts the Dart analyzer.
Add the line
"dart.sdkPath": "[YOUR FUCHSIA DIR LOCATION]/third_party/dart/tools/sdks/dart-sdk",
and (Ctrl+Shift+P) “Reload Window”.