flutter-tools.nvim icon indicating copy to clipboard operation
flutter-tools.nvim copied to clipboard

[BUG] fvm not working on windows

Open Azkarell opened this issue 10 months ago • 9 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

Running :FlutterRun with fvm enabled throws ENOENT: no such file or directory in windows grafik although path is detected correctly

Expected Behavior

Running :FlutterRun in windows should run flutter

Steps To Reproduce

my conifg with lazy: { 'akinsho/flutter-tools.nvim', lazy = false, dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('flutter-tools').setup { fvm = true, -- debugger = { -- enabled = true, -- run_via_dap = true, -- register_configurations = function(paths) -- local file = io.open('.vscode/launch.json', 'r') -- if file ~= nil then -- io.close(file) -- require('dap.ext.vscode').load_launchjs() -- end -- end, -- }, } require('telescope').load_extension 'flutter' end, },

Environment

- OS: Windows 11 Pro
- Flutter version: fvm mit flutter 3.13.9
- Is flutter in $PATH: yes
- neovim version: 0.9.5

Anything else?

I tried to find out what is happening and it might not even be the fault of this tool but i am quite new to neovim and just evaluating if i want to continue using it. what i found that just the line :lua =vim.uv.spawn("C:\\\fvm\versions\3.13.9\bin\flutter", { { "run" }}) already fails

just running "C:\\\fvm\versions\3.13.9\bin\flutter" in pwsh or cmd or even with Start-Process is working.

Azkarell avatar Mar 28 '24 09:03 Azkarell

Does it work if you run fvm outside neovim: fvm flutter run?

sidlatau avatar Mar 28 '24 13:03 sidlatau

yes everything works as expected outside of neovim. only this plugin/neovim can't start it.

Azkarell avatar Mar 29 '24 00:03 Azkarell

Please check the latest plugin version,https://github.com/akinsho/flutter-tools.nvim/commit/d8f2eac1734e0e68050bc57600e5f2ba775b1ec4 commit may help. If there is still a problem, please reopen the issue.

sidlatau avatar Aug 29 '24 20:08 sidlatau

Facing this issue on windows with latest commits. This happens when I set fvm = true. However I've noticed that if i set fvm = false and add flutterpath = 'C:\Users\daban\fvm\versions\3.19.5\bin\flutter.bat' everthing works fine. Maybe change fvm path from ..\flutter to ..\flutter.bat. Any thoughts? image

AyushUlric avatar Aug 30 '24 08:08 AyushUlric

Yea, it looks like missing .bat suffix is a problem. I will reopen this case to fix it.

sidlatau avatar Aug 30 '24 11:08 sidlatau

I do not have Windows, so I am not sure if the path is the same as in macOS. @AyushUlric, if you have time please check if this works for you https://github.com/akinsho/flutter-tools.nvim/pull/386? The setup would be:

return {
  "akinsho/flutter-tools.nvim",
  branch = "fvm-on-windows",
...
}

sidlatau avatar Aug 30 '24 16:08 sidlatau

@sidlatau, didn't work, same error. I hope I didn't mess up the setup as I am fairly new to nvim so attaching my setup code below.

image

image

I then updated all my plugins from the Lazy menu and restarted nvim.

I think on windows flutter and flutter.bat will always be in the same directory and the current path correctly points to the flutter file, hope that helps.

AyushUlric avatar Aug 30 '24 18:08 AyushUlric

@AyushUlric thanks for testing. I see you are using a global path to fvm flutter. But there should be a local one in your project, in .fvm directory: image Plugin constructs path .fvm/flutter_sdk/bin/flutter.bat. Does this file exist in your project? Did you run fvm use <flutter version> in your project directory?

sidlatau avatar Sep 05 '24 10:09 sidlatau

@sidlatau Yes I did run the fvm use command and I have the .fvm directory in my project root. But I noticed that flutter_sdk directory is actually a shotcut which points to the global fvm path. I checked all my fvm projects and it seems to be common in all of them.

image image

Maybe that's how it is on Windows?

BTW I added the global path because thats what showed up in error logs with path not found.

image

AyushUlric avatar Sep 05 '24 11:09 AyushUlric