Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DART SDK not found #16

Closed
septimagus opened this issue Sep 21, 2020 · 8 comments
Closed

DART SDK not found #16

septimagus opened this issue Sep 21, 2020 · 8 comments

Comments

@septimagus
Copy link

I've tried using vim-lsc-dart as a plugin on neovim (latest version). I've got Flutter up and running, it is in my path and I am able to run it from the terminal. As soon as I display a .dart file, neovim says "DART SDK not found". I tried running the dart analyzer snapshot using the vim lsc plugin. It seems to run on the terminal but doesn't really do anything much to the .dart file. Any way to get it working? Thanks in advance

@natebosch
Copy link
Owner

I would expect the error to be Could not find the Dart SDK. - did you copy/paste that message?

When you are in nvim are you able to run !dart --help?

natebosch added a commit that referenced this issue Sep 21, 2020
In case this is the problem in #16

Add a more specific error message when neither `dart` nor `flutter` is
in `$PATH`.
@septimagus
Copy link
Author

"Could not find either a dart or flutter command. Your $PATH must contain either the Dart of Flutter bin directory". This is what shows up now. Flutter and Flutter doctor are still working from the terminal, I tried running the !dart --help in nvim and this is what I get

"Usage: dart [] []

Executes the Dart script with the given list of .

Common VM flags:
--enable-asserts
Enable assert statements.
--help or -h
Display this message (add -v or --verbose for information about
all VM options).
--packages=
Where to find a package spec file.
--observe[=[/]]
The observe flag is a convenience flag used to run a program with a
set of options which are often useful for debugging under Observatory.
These options are currently:
--enable-vm-service[=[/]]
--pause-isolates-on-exit
--pause-isolates-on-unhandled-exceptions
--warn-on-pause-with-no-debugger
This set is subject to change.
Please see these options (--help --verbose) for further documentation.
--write-service-info=<file_uri>
Outputs information necessary to connect to the VM service to the
specified file in JSON format. Useful for clients which are unable to
listen to stdout for the Observatory listening message.
--snapshot-kind=<snapshot_kind>
--snapshot=<file_name>
These snapshot options are used to generate a snapshot of the loaded
Dart script:
controls the kind of snapshot, it could be
kernel(default) or app-jit
<file_name> specifies the file into which the snapshot is written
--version
Print the SDK version."

I did "EXPORT" my flutter path to the bashrc, when I installed flutter. Could this be an issue? My PATH variable does have flutter/bin at the end of it though.

@natebosch
Copy link
Owner

Flutter and Flutter doctor are still working from the terminal

How do you normally run nvim? Can you try running it from the terminal where the flutter command is working?

I tried running the !dart --help in nvim and this is what I get

That's the output I would expect if your $PATH is set up correctly, however...

"Could not find either a dart or flutter command. Your $PATH must contain either the Dart of Flutter bin directory".

I added this error with a specific check for where I would expect :! dart would not work. I don't know what situation would lead to :! dart executing dart, while executable('dart') is false...

if !executable('dart') && !executable('flutter')
echoerr 'Could not find either a `dart` or `flutter` command. '

@septimagus
Copy link
Author

septimagus commented Sep 23, 2020

I'm running it from the same terminal, tried two different terminal emulators and two versions of nvim(both stable)too. Do you think there is any way I can manually set the path that the lsc-dart plugin looks into (for a test case)?

@natebosch
Copy link
Owner

I'm not sure what other solutions to look for here. I suppose one workaround we could try is adding a configuration to specify the path to the SDK directly instead of searching for it.

Can you try out the branch dart-sdk-path-config and then add the path to your Dart SDK in g:lsc_dart_sdk_path?

#17

@septimagus
Copy link
Author

It's working, all the errors have disappeared and auto complete is showing suggestions, thanks a bunch. Is there any way I could enable closing labels or perhaps, could you point me in the right direction with regards to the documentation of such settings?

@natebosch
Copy link
Owner

It's working, all the errors have disappeared and auto complete is showing suggestions

Awesome! I'll merge that PR.

Is there any way I could enable closing labels

Not currently. I filed #18 as a feature request, however its not likely I'll get to it soon since I use vim, not nvim, and there is no support for virtual text in vim.

@domhel
Copy link

domhel commented Nov 4, 2021

I had the same issue with a strange solution.

The following was in my .bashrc:
export PATH="$PATH:~/flutter/bin"
and it could not find dart or flutter, even though I could execute the command from shell and with :!dart in nvim.

Then I changed it in the .bashrc to export PATH="$PATH:/home/<my_user_name>/flutter/bin"
and now it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants