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

Unable to get autocompletion for dependencies in pom.xml #311

Closed
anthonyvdotbe opened this issue Apr 17, 2019 · 9 comments
Closed

Unable to get autocompletion for dependencies in pom.xml #311

anthonyvdotbe opened this issue Apr 17, 2019 · 9 comments
Assignees
Labels
bug Something isn't working completed
Milestone

Comments

@anthonyvdotbe
Copy link

Describe the bug
I'm unable to get autocompletion for dependencies in pom.xml, as provided by #195

To Reproduce
Steps to reproduce the behavior:

  1. set up a fresh portable installation
  2. install Java Extension Pack
  3. execute the command "Maven: Generate From Maven Archetype"
  4. choose maven-archetype-quickstart
  5. add the generated project to the workspace and open its pom.xml
  6. in the <dependencies> section, add <dependency><groupId></groupId><artifactId></artifactId><version></version></dependency>

Expected: autocompletion is available when typing in groupId, then in artifactId, then in version

Actual: I'm unable to get any kind of autocompletion working

Environments

  • OS: Windows 10 1809
  • VS Code version: 1.33.1
  • Extension version: 0.16.1

Additional context
I thought maybe it was due to my Maven's settings.xml (as it uses localRepository and mirrors, a.o.), but even when trying with an empty settings.xml, the issue still reproduces.

@Eskibear
Copy link
Member

The autocompletion retrieves info from a) local repository, b) maven central repository.

For a), the path is hard-coded for the moment, as mentioned in #195 (comment) , which I suppose is broken in your case.
https://github.com/Microsoft/vscode-maven/blob/ff797b4fc6cfa29b334ecb56e1a29cf7256f4be4/src/completion/localProvider.ts#L14

For b), it calls Maven search API to get info of artifacts. I think this one should at least work for you, can you give it a try to manually trigger completion?
https://github.com/Microsoft/vscode-maven/blob/ff797b4fc6cfa29b334ecb56e1a29cf7256f4be4/src/utils/requestUtils.ts#L9

Note that the API accepts word-based keywords as input parameter, so see following examples

Case 1

<dependency>
  <groupId>com.github|</groupId>
.....

It queries with "com" and "github", and get reasonable results.

Case 2

<dependency>
  <groupId>com.githu|</groupId>
.....

It queries with "com" and "githu", and it should get NO reasonable results.

@Eskibear Eskibear added bug Something isn't working needs more info Further information is requested labels Apr 18, 2019
@anthonyvdotbe
Copy link
Author

Indeed, a) won't work in my case, thanks for pointing that out.

For b), I'm still unable to get autocompletion working with Case 1. I'm only getting an "Emmet abbreviation" suggestion, and with "emmet.showExpandedAbbreviation": "never" I'm getting "No suggestions".

Maybe irrelevant, but when starting VS Code with --verbose, upon hitting Ctrl+space in Case 1, the following is printed:
[main 2019-04-18T06:55:33.938Z] [storage state.vscdb] updateItems(): insert(Map(1) {expandSuggestionDocs => true}), delete(Set(0) {}) [main 2019-04-18T06:55:33.941Z] [storage state.vscdb] Trace (event): BEGIN TRANSACTION [main 2019-04-18T06:55:33.949Z] [storage state.vscdb] Trace (event): INSERT INTO ItemTable VALUES ('expandSuggestionDocs','true') [main 2019-04-18T06:55:33.964Z] [storage state.vscdb] Trace (event): END TRANSACTION

Let me know if there's anything else I can do to debug this further.

@no-response no-response bot removed the needs more info Further information is requested label Apr 18, 2019
@steven87vt
Copy link

Maybe its me but I have a similar issue. I just started using vs code for java development this week, coming from intellij.

I am on centos 7, vs code 1.33.1, extension 0.16.1

In my case i have a few simple projects set up, two of them are maven based. When I make changes to the individual pom files, the maven logs show it builds successfully. It can even run the life-cycle commands properly but I have 0 intellisense for any pom elements (outside of keys already present in the file which are provided by default).

image

@Eskibear Eskibear self-assigned this Apr 22, 2019
@Eskibear
Copy link
Member

Confirmed it's a regression introduced since 0.16.0.

@Eskibear Eskibear added this to the 0.16.2 milestone Apr 22, 2019
@Eskibear
Copy link
Member

vscode-maven-0.16.1-fix-completion.vsix.zip

@steven87vt @anthonyvdotbe Above is a private build, please give it a try, see if the auto-completion gets back to work.

@anthonyvdotbe
Copy link
Author

@Eskibear I can't get auto-completion to work with the private build (just for the record: after installing the language pack, I uninstalled the Maven extension that came with it, and installed the private build instead)

@Eskibear
Copy link
Member

@anthonyvdotbe As I didn't change the version in the private build (i.e. 0.16.1), VS Code might directly load the extension from its cache. Can you try the following steps and share the result again?

  1. Directly remove the folder C:\Users\<username>\.vscode\extensions\vscjava.vscode-maven-0.16.1
  2. Reload VS Code.
  3. Install the private build.

@anthonyvdotbe
Copy link
Author

@Eskibear yes, it was a caching issue indeed. Autocompletion works perfect now, thanks!

@Eskibear
Copy link
Member

Shipped in 0.16.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed
Projects
None yet
Development

No branches or pull requests

3 participants