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

Completion not showing top level functions #40417

Closed
shinayser opened this issue Jan 31, 2020 · 12 comments
Closed

Completion not showing top level functions #40417

shinayser opened this issue Jan 31, 2020 · 12 comments
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.

Comments

@shinayser
Copy link

The http library has a put method, but it doesn't show up on the completion window:

image

If I scroll down the entire completion window, the put method is not even there.
This is the same for other methods:

image
image

@shinayser shinayser changed the title Completion should show top level functions Completion not showing top level functions Jan 31, 2020
@shinayser
Copy link
Author

Another one for the Completion Overlord @pq !

@bwilkerson bwilkerson added 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. labels Jan 31, 2020
@pq
Copy link
Member

pq commented Feb 6, 2020

Is this one consistent for you?

In a quick attempt I wasn't able to repro:

image

Does it reproduce in a file in the same project w/ no other imports?

@shinayser
Copy link
Author

I think that there are two differences in your test:

  • You are using Flutter, I was using a standalone CLI application
  • You are using VsCode (or am I wrong?)

I just tried with a new project and still not working. Please follow my steps:

  • On Intellij, click File -> New -> Project...
  • Select Dart -> Console Application. Name it and press ok.
  • Open the project, and go to the pubspec and add http: any on dependencies.
  • Open the file main.dart located on the bin. It containes the main method.
  • Add import 'package:http/http.dart'; on the top of the file.
  • Try to put, post, get inside the main method.
  • Doesn't work.

image

@pq
Copy link
Member

pq commented Feb 6, 2020

Hmmm. So I am using IntelliJ. Following your steps w/ a sample console app works for me too:

image

(Dart VM version: 2.8.0-edge.e84bea25df23ea5f149fc808a6423c7500b9cace)

🤔

What Dart SDK are you using?

@shinayser
Copy link
Author

Dart VM version: 2.8.0-dev.0.0 (Wed Dec 11 10:31:10 2019 +0100) on "windows_x64"

@shinayser
Copy link
Author

Ok, I just updated my sdk. Now I have:

Dart VM version: 2.8.0-dev.8.0 (Thu Feb 6 15:47:55 2020 +0100) on "windows_x64"

And still no completion =(

@shinayser
Copy link
Author

I am a stupid person. Sorry for taking your time @pq I just found out what was going wrong...

This stupid guy here added http depency to the environment instead of dependencies:

image

But that raised one question:

Why it wasn't being auto completed, but could be imported normally? 🤔

@pq
Copy link
Member

pq commented Feb 6, 2020

Amazing! (And a relief since I couldn't repro on windows either! ;))

Why it wasn't being auto completed, but could be imported normally?

I believe http comes in as a transitive dependency of test. You can confirm this by removing the dependency on test, upgrading and you'll see a squiggle on the import:

image

As it happens we've got a lively thread going about how we can improve diagnostics (and support generally) for transitive dependencies here dart-lang/linter#29. Feel free to chime in!

All of that said, it's also weird that we are not flagging http as an invalid environment in your pubspec. That just seems wrong? (fyi @bwilkerson)

@bwilkerson
Copy link
Member

We currently do a fairly limited job of validating the pubspec.yaml file. This would be a good thing to check if we ever enhance that.

@shinayser
Copy link
Author

shinayser commented Feb 6, 2020

Great! Good to see that my stupidness can be of value to enhance the tooling =)

And thanks @pq for your explanation about the http!

@shinayser
Copy link
Author

I created a new thread for trackign this issue. Thanks everytone and sorry for my mistake!

@pq
Copy link
Member

pq commented Feb 6, 2020

No worries. Thanks for the follow-up!

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.
Projects
None yet
Development

No branches or pull requests

3 participants