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

[BUG] 'flutter run' not compatible with 'open file' ? #391

Closed
1 task done
Dieterbe opened this issue Oct 2, 2024 · 6 comments · Fixed by #392
Closed
1 task done

[BUG] 'flutter run' not compatible with 'open file' ? #391

Dieterbe opened this issue Oct 2, 2024 · 6 comments · Fixed by #392

Comments

@Dieterbe
Copy link

Dieterbe commented Oct 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

i have a project in ~/code/ptc, therefore i run nvim code/ptc in my home directory.
when i do FlutterRun, and i get an error, the console output is something like this:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building:
no rangeStarts found for Articulation.cervicalSpineFlexion
'package:ptc/backend/movements.dart':
Failed assertion: line 72 pos 12: 'rangeStarts.isNotEmpty'

When the exception was thrown, this was the stack:
#2      new ArticulationMovements (package:ptc/backend/movements.dart:72:12)
#3      _ArticulationsScreenState.build.<anonymous closure> (package:ptc/ui/articulations_screen.dart:58:26)

normally, i should be able to hover over the filename - e.g. movements.dart - and hit 'gf' to go to the file, however, flutter run puts the 'ptc' part in the path, but vim is already inside the ptc directory, therefore it can't find the path.

the workaround is that a copy paste the output into a different buffer, remove the 'ptc/' and then 'gf' works as expected..

Expected Behavior

not sure. maybe flutter run shouldn't print the base directory of the project?

Steps To Reproduce

trigger a bug during execution and try to use 'gf' on the returned file.

Environment

- OS: arch linux
- Flutter version: 3.22.3
- Is flutter in $PATH: yes
- neovim version: v0.10.1

Anything else?

No response

@sidlatau
Copy link
Collaborator

sidlatau commented Oct 2, 2024

Thank you for providing detailed information on the issue.

The intention here is to keep the original behaviour because we do not want to modify the logs that we receive from the Flutter framework. The logs are generated directly by Flutter, and altering them could lead to inconsistencies or confusion, especially when debugging across different environments. Maintaining the full path as it is output by Flutter ensures we preserve the integrity of the log information.

@sidlatau sidlatau closed this as completed Oct 2, 2024
@Dieterbe
Copy link
Author

Dieterbe commented Oct 3, 2024

maybe there's a way to alter 'gf' in lua, to strip the base path

@sidlatau
Copy link
Collaborator

sidlatau commented Oct 3, 2024

You could try to use includeexpr.

@sidlatau
Copy link
Collaborator

sidlatau commented Oct 3, 2024

@sidlatau
Copy link
Collaborator

sidlatau commented Oct 4, 2024

I am reopening this case, I added package resolve function based on what I found in https://github.com/dart-lang/dart-vim-plugin. @Dieterbe would it be possible for you to test it? If you are using lazy here is example setup to test:

return {
  "nvim-flutter/flutter-tools.nvim",
  branch = "resolve-url",
....
}

@sidlatau sidlatau reopened this Oct 4, 2024
@sidlatau sidlatau linked a pull request Oct 4, 2024 that will close this issue
@Dieterbe
Copy link
Author

Dieterbe commented Oct 4, 2024

wow! accommodating the functionality in flutter-tools.nvim's lua code was actually the outcome i was hoping for, but i was not ready to do the work, and i didn't want to impose the burden on you.

i'm excited that you decided to give this a shot, and it will be my pleasure to test it and provide my feedback. stay tuned!

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

Successfully merging a pull request may close this issue.

2 participants