Giter Site home page Giter Site logo

Comments (7)

RomjanHossain avatar RomjanHossain commented on May 27, 2024 1

After creating a new flutter project flutter create test and opening the project file in neovim works. But as I go to my previous project and open it by neovim doesn't woks.

I'm testing flutter-tools on my previous project and it shows those error but not in the new one.

Thanks

from flutter-tools.nvim.

akinsho avatar akinsho commented on May 27, 2024

@RomjanHossain there are a few issues with your config, you should not be trying to also start dartls with lspconfig. The readme explains that this plugin is already starting dartls itself so the user should not do that with lspconfig.

Both of the values below should not both be filled out only one or the other should be filled out, it might be a good idea to go through the README again since it also explains that the flutter lookup command should be a shell command that returns the path to your flutter binary.

  flutter_path = "/opt/flutter/bin/flutter", 
  flutter_lookup_cmd = 'flutter',

In your case either specify the absolute path as you have done (although that path looks strange i.e. a top level directory called opt) or a command that if you executed it in the terminal would return the full path to fullter

from flutter-tools.nvim.

RomjanHossain avatar RomjanHossain commented on May 27, 2024

I removed this part from the config as the README.md said it starts with flutter-tools.

require'lspconfig'.dartls.setup{
  filetypes = {"dart"},
  init_options = {
    closingLabels = false,
    flutterOutline= true,
    onlyAnalyzeProjectsWithOpenFiles = false,
    outline=false,
    suggestFromUnimportedLibraries = true,
  }
}

and I tried to get my flutter absolute path by
which flutter and it returns /usr/bin/flutter.

I added it to my config

  flutter_path = "/usr/bin/flutter", 
  flutter_lookup_cmd = 'flutter',

but still not working.........! I'm sorry but am I doing this right.

from flutter-tools.nvim.

akinsho avatar akinsho commented on May 27, 2024

@RomjanHossain tbh if your flutter is installed in a normal local and is in your $PATH then you don't need to specify flutter path or lookup_cmd but importantly you should not specify both, the lookup cmd in your example is wrong because it is not a shell command that will return your flutter path. Try to remove both options and see if that works. Also please verify that flutter is part of your $PATH there are instructions on how to add it to your path on the flutter website's installation section.

from flutter-tools.nvim.

RomjanHossain avatar RomjanHossain commented on May 27, 2024

removing both lines shows "Error running flutter SDK" and only removing flutter_lookup_cmd='flutter' doesn't show this error.

and in my path echo $PATH | grep flutter i found flutter in /opt/flutter/bin dir and which flutter shows /usr/bin/flutter dir.
I tried both path /opt/flutter/bin/flutter and /usr/bin/flutter but it shows the same error.
btw, I use manjaro and I installed flutter from AUR -> yay -S flutter.

from flutter-tools.nvim.

akinsho avatar akinsho commented on May 27, 2024

@RomjanHossain tbh I have no idea how manjaro lays out its packages, I'm not at all clear on why two different paths are being returned i.e. a different one in your path than the result of which are you sure there is only one installation on your system?

In either case can you try flutter_lookup_com = 'which flutter' and no flutter_path, see if that works. If not try a plain /opt/flutter/bin/flutter -h in the terminal, does that work? if it does try that in your flutter_path if not try /usr/bin/flutter -h if that works then try that in the flutter path.

If none of that works (this is a long shot) try flutter sdk-path to see if that prints anything. If the command exists then try setting derive_lsp_path to true (details in the README).

To be clear about what this is all about. You need to tell this plugin where to find flutter (the correct value should be a path to the binary) so it can run flutter commands. In most normal cases flutter it's just somewhere like /usr/bin/flutter and if you run /usr/bin/flutter -<some-cmd> that should work and should also be enough for this plugin. By default if a user has installed flutter and it is in the path neovim should be able to find it by first checking executable('flutter') that should be 1 then getting the path via exepath('flutter') special config should only be for complex setups (maybe this is your case).

from flutter-tools.nvim.

RomjanHossain avatar RomjanHossain commented on May 27, 2024

i tried flutter_lookup_cmd='which flutter with no flutter path but it doesn't work.
AND /usr/bin/flutter -h + /opt/flutter/bin/flutter -h both works on the terminal :). as previously said I tried adding both path to the flutter path but no luck.

flutter sdk-path says command error. flutter doctor -v shows
Flutter version 2.0.6 at /opt/flutter <- this location.
setting lsp_derive_path to true/false isn't working either.

from flutter-tools.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.