dart-lang / dart-vim-plugin

Syntax highlighting for Dart in Vim
BSD 3-Clause "New" or "Revised" License
640 stars 55 forks source link

Set SDK to dart-beta (non-nullable) #118

Closed vincevargadev closed 3 years ago

vincevargadev commented 3 years ago

I'd like to work on a codebase with null-safety.

I installed Dart's beta using brew, as specified in these two docs:

In the end, I got these:

% dart --version
Dart SDK version: 2.12.0-29.10.beta (beta) (Tue Nov 17 10:50:22 2020 +0100) on "macos_x64"
% which dart
/usr/local/bin/dart
% /usr/local/opt/dart-beta/libexec/bin/dart --version
Dart SDK version: 2.12.0-29.10.beta (beta) (Tue Nov 17 10:50:22 2020 +0100) on "macos_x64"

# Old SDK is still there
% /usr/local/opt/dart/libexec/bin/dart --version
Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "macos_x64"

It seems like Vim is still using the old SDK.

In IntelliJ, I can switch between the stable and beta Dart channels, by changing the SDK path from /usr/local/opt/dart/libexec to /usr/local/opt/dart-beta/libexec. After that change is done, IntelliJ works correctly.

I'd like Vim to use the same Dart SDK path, but so far I can't get it done, and I don't find info about how to change the Dart SDK so that Vim recognizes that.

I tried setting export DART_SDK=/usr/local/opt/dart-beta/libexec, but it didn't change anything.

I'm new to Vim, so if this is not the right place to ask this question, let me know.

natebosch commented 3 years ago

You should change your $PATH so the dart executable in your path is the one in the SDK you want to use.

We don't read any DART_SDK variable, and we don't hardcode any SDK locations - the path is always discovered based on the location of the dart executable.