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

Obtaining source span for DartObject (computeConstantValue) #34062

Open
matanlurey opened this issue Aug 1, 2018 · 0 comments
Open

Obtaining source span for DartObject (computeConstantValue) #34062

matanlurey opened this issue Aug 1, 2018 · 0 comments
Labels
analyzer-api Issues that impact the public API of the analyzer package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. customer-google3 P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@matanlurey
Copy link
Contributor

(Reference issue is angulardart/angular#1350)

tl;dr: AngularDart has a metadata-based API for consumers:

import 'package:angular/angular.dart';

@Component(
  selector: 'bar',
)
class Foo {}

Imagine we wanted to validate that selector was always the class name, kabob-cased. The best we can do today is present either a source span for class Foo or a source span for the entire @Component annotation - of which it can become quite large for complex components.

We'd like to be able to get a source span so we could present:

@Component(
  selector: 'bar',
  ^^^^^^^^^^^^^^^
  Expected 'foo' for 'class Foo', but got 'bar'

Unfortunately it looks like we lack the APIs in package:analyzer to do this. We could re-parse the file, and try to "recompute" what the source span would be, but that would likely be non-trivial and require a lot of ugly code. Any suggestions please?

@matanlurey matanlurey added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. customer-google3 labels Aug 1, 2018
@matanlurey matanlurey added the P2 A bug or feature request we're likely to work on label Aug 27, 2018
@bwilkerson bwilkerson added the type-enhancement A request for a change that isn't a bug label Aug 28, 2018
@stereotype441 stereotype441 added the analyzer-api Issues that impact the public API of the analyzer package label Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-api Issues that impact the public API of the analyzer package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. customer-google3 P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants