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

Analysis server fails to notice that a file re-exporting main is runnable #45192

Open
stereotype441 opened this issue Mar 4, 2021 · 2 comments
Labels
area-devexp Developer Experience related issues (DevTools, IDEs, Analysis Server, completions, refactoring, etc) contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) devexp-server Issues related to some aspect of the analysis server P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@stereotype441
Copy link
Member

Steps to reproduce:

  • Check out Dart SDK as of 8be5353
  • In IntelliJ, open the file pkg/front_end/test/unit_test_suites.dart
  • Right click within the file view

Expected result: the menu item Run 'unit_test_suites.dart' should be shown

Observed result: no Run menu item is shown

Note that all this file does is export unit_test_suites_impl.dart, which declares a main function. Therefore it should have a main function in its export namespace, so it should be runnable. Prior to null safety, this would have been a really obscure use case. However, with null safety, there's actually a really good reason to do this: it allows the entry point to be marked with // @dart = 2.9 (so that the program will be run in weak null safety mode), while leaving main opted in (so that it gets the static compilation benefits of null safety mode). This is necessary because due to out-of-order migration, some of the code in the program's transitive import graph has not yet been migrated to null safety. Now that null safety is out, I suspect this is going to be a much more common use case.

@stereotype441 stereotype441 added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Mar 4, 2021
dart-bot pushed a commit that referenced this issue Mar 4, 2021
Bug: #45192
Change-Id: I54300959872b02bb783923ce51e4aa2392e6c482
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189041
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Paul Berry <[email protected]>
@bwilkerson
Copy link
Member

@alexander-doroshko I don't remember having a server protocol to tell clients whether a file is executable, so I suspect that this is being done in the IntelliJ plugin. Can you confirm?

@alexander-doroshko
Copy link

True, run configurations are handled by the Dart plugin. We don't handle such case yet. Request is welcome: https://youtrack.jetbrains.com/issues/WEB (Project: Web, Subsystem: Dart).

For now, you'll need to configure a run configuration manually: main menu -> Run -> Edit Configurations -> [+] -> Dart Test

@scheglov scheglov added the P3 A lower priority bug or feature request label Mar 5, 2021
@srawlins srawlins added the contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) label May 20, 2022
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Mar 14, 2024
@srawlins srawlins added the devexp-server Issues related to some aspect of the analysis server label Aug 16, 2024
@bwilkerson bwilkerson added area-devexp Developer Experience related issues (DevTools, IDEs, Analysis Server, completions, refactoring, etc) and removed area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp Developer Experience related issues (DevTools, IDEs, Analysis Server, completions, refactoring, etc) contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) devexp-server Issues related to some aspect of the analysis server P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants