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 insert "dependency" Maven Snippet as expected #310

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

Unable to insert "dependency" Maven Snippet as expected #310

anthonyvdotbe opened this issue Apr 17, 2019 · 5 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@anthonyvdotbe
Copy link

anthonyvdotbe commented Apr 17, 2019

Describe the bug
I'm unable to insert the "dependency" Maven Snippet as expected. There are 2 issues:

  • at first I only get word-based suggestions
  • once I do get the suggestion, it doesn't take the already-typed angle brackets into account

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, type "<" and hit Ctrl+Space

Expected: a suggestion for the "dependency" Maven snippet

Actual: only word-based suggestions

  1. accept the word-based "dependency" suggestion & place the cursor after the closing angle bracket
  2. type "<" and hit Ctrl+Space
  3. accept the suggested "dependency" Maven Snippet

Expected: the snippet is correctly inserted

Actual: the snippet is inserted within the existing angle brackets

Environments

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

Screenshots
This is what I have after following the reproducer steps above:

image

@Eskibear Eskibear added the bug Something isn't working label Apr 18, 2019
@Eskibear Eskibear added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 22, 2019
@Eskibear
Copy link
Member

at first I only get word-based suggestions

This part is duplicated with #311, and should have been fixed now.

Actual: the snippet is inserted within the existing angle brackets

For the duplicated "<" and ">", I don't have a perfect solution now. The CodeSnippet is a hard-coded snippet string as below. I don't know whether vscode has mechanism to detect and remove duplicated brackets, or we have to handle it by our own.

https://github.com/Microsoft/vscode-maven/blob/1dd04bd39cae35ef9106bd412016cb191e3b0c9e/src/completion/completionProvider.ts#L13-L27

@Eskibear
Copy link
Member

In PR #323 , I added "<" trigger for the snippet to fix the issue in Step 6

  1. in the section, type "<" and hit Ctrl+Space

As for hitting Ctrl+Space closing angle bracket, previous parsing logic doesn't handle closing node well, and it needs a little bit refactoring to make it recognizable.

@Eskibear Eskibear added this to the 0.17.0 milestone May 10, 2019
@Eskibear Eskibear self-assigned this May 10, 2019
@Eskibear Eskibear modified the milestones: 0.17.0, backlog May 16, 2019
@Eskibear
Copy link
Member

Just to mention that I find different behaviors when you type "<".
Normally VSCode will append the corresponding ">" immediately for you. But when RedHat's XML extension is installed, ">" will not be appended.

In PR #329 , I've added naive logic to handle both cases, so users won't get strange behaviors during editing.

@thandy1212
Copy link

I'm having the same issue on Mac. Similar to #311 (comment) where I am not getting any intellisense support for pom. The current version installed is 0.27.1 which came bundled with the extension pack.

@Eskibear
Copy link
Member

It's using TextEdit to update the file now, should have no problem any longer. I'm closing it.

Please open a new issue with repro steps if you find similar issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants