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

no 'localName' completion for top-level html element of html package #24178

Closed
guillermooo opened this issue Aug 23, 2015 · 5 comments
Closed
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on

Comments

@guillermooo
Copy link
Contributor

More details here:

guillermooo/dart-sublime-bundle#563

@bwilkerson bwilkerson added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-completion Issues with the analysis server's code completion feature labels Aug 23, 2015
@bwilkerson
Copy link
Member

Given your example:

import "package:html/parser.dart";

main() {
  var p1 = parse("<p>hello</p>");
  var t1 = p1.nodes.first;
  print(t1.^);
}

Note that parse returns a Document, Document.nodes returns a NodeList, and NodeList.first returns a Node. Given that localName is not defined on Node, not including it in the list seems reasonable to me. Am I missing something?

@guillermooo
Copy link
Contributor Author

import "package:html/parser.dart";

main() {
  var p1 = parse("<p>hello</p>");
  var t1 = p1.nodes.first;
  print(t1.localName);
}

That returns "html" for me. That's what puzzled me, but I have not dug into the code.

@bwilkerson
Copy link
Member

To be clear, I was referring to the static types of the methods and getters, not the run-time types of the values returned by them.

@guillermooo
Copy link
Contributor Author

I think I was expecting the Dart VM to return an error in checked mode here and enforce this:

...
(t1 as dom.Element).localName
...

But it turns out the VM never enforces anything, it's just the DAS that is able to flag more issues as you get more explicit with var decls, etc. I keep forgetting this.

So everything works as I expect with this:

...
// var t1 = parsed.nodes.first;
dom.Node t1 = parsed.nodes.first;

t1.localName // DAS flags this now but the VM runs it happily anyway

@guillermooo
Copy link
Contributor Author

After your explanations, this is a no-bug, so closing this out.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on and removed Priority-Medium labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants