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 doesn't run macros correctly when they're provided through an "export" #55746

Closed
rrousselGit opened this issue May 16, 2024 · 5 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@rrousselGit
Copy link

Hello!

It appears that using export 'macro.dart' breaks the "Go to augmentation" codelenses.

You could define any macro:

// macro.dart
macro class Example {
...
}

Then re-export it in a different file:

// foo.dart
export 'macro.dart';

And finally import the macro through the export:

import 'foo.dart';

@Example()
// No "Go to augmentation" shows up here
class MyClass {}

cc @DanTup

@DanTup
Copy link
Collaborator

DanTup commented May 16, 2024

@rrousselGit are you sure the macro is running? While I can reproduce the CodeLens not appearing, it also seems like the macro is not running (because here, "hello" becomes an error):

m.mp4

The behaviour I'm seeing doesn't seem like just a CodeLens issue, but I don't know if it's the same as what you're seeing.

@rrousselGit
Copy link
Author

This is more than a codelense issue yes.

But if you run the code, it works:

You can dart --enable-experiment macros lib/foo.dart just fine. So the error is purely on the analyzer side

@DanTup DanTup changed the title Macros: "Go to augmentation" codelenses don't show if the macro is re-exported Analysis server doesn't run macros correctly when they're provided through an "export" May 16, 2024
@DanTup
Copy link
Collaborator

DanTup commented May 16, 2024

Ah, gotcha. I've updated the title then - seems to be something wrong with the analysis server running the macro and not as I first suspected with the generation of LSP CodeLenses.

(cc @scheglov)

@DanTup DanTup added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label May 16, 2024
@scheglov
Copy link
Contributor

I can reproduce it.

@scheglov scheglov self-assigned this May 16, 2024
@scheglov scheglov added the P1 A high priority bug; for example, a single project is unusable or has many test failures label May 16, 2024
@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/366901

copybara-service bot pushed a commit that referenced this issue May 16, 2024
Bug: #55746
Change-Id: Ib18b60467ce946346072c04b1df7b36d12e4cab1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366901
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
felangel added a commit to felangel/data_class that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
Development

No branches or pull requests

3 participants