question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autocompletion removes a line instead of completing it

See original GitHub issue

Sanity check

  • I certify that the redhat.ansible extension is in use and the language of the document in this bug report shows up as Ansible

Summary

When I press enter, tab or select autocompletion line with left mouse button, the line I was currently typing disappears.

https://user-images.githubusercontent.com/97241456/165756567-4458f1ec-328f-44fc-87d6-2a9929936ef9.mov

Extension version

0.8.1

VS Code version

1.66.2

Ansible Version

└─$ ansible --version                                                                                                                          127 ⨯
ansible [core 2.12.2]
  config file = /Users/maciej/.ansible/ansible.cfg
  configured module search path = ['/Users/maciej/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/5.3.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/maciej/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.10.2 (main, Feb  2 2022, 05:51:25) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True

OS / Environment

└─$ sw_vers ProductName: macOS ProductVersion: 12.3.1 BuildVersion: 21E258

└─$ ansible-lint --version WARNING: PATH altered to include /opt/homebrew/Cellar/ansible-lint/6.0.2/libexec/bin ansible-lint 6.0.2 using ansible 2.12.3

Relevant log output

None available. Please let me know if there are any logs I should be providing at this stage.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
priyamsahoocommented, May 23, 2022

Hi, just an update. I am working today from the same machine, not sure what has changed but this bug has gone away. Now, upon pressing enter, the line autocompletes and cursor moves to the next line indented (as expected).

VSC:

Version: 1.67.1
Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d
Date: 2022-05-06T12:37:14.619Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.4.0

Ansible: v0.9.0 preview

Ansible & ansible-lint:

└─$ ansible-lint --version
WARNING: PATH altered to include /opt/homebrew/Cellar/ansible-lint/6.0.2/libexec/bin
ansible-lint 6.0.2 using ansible 2.12.3
                                                                                                                                                                    
┌──(maciej㉿Maciej's-Maccy-Air)-[~/DevOps/ip-ansible-servicenow]
└─$ ansible --version
ansible [core 2.12.4]
  config file = /Users/maciej/.ansible/ansible.cfg
  configured module search path = ['/Users/maciej/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/5.6.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/maciej/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.10.2 (main, Feb  2 2022, 05:51:25) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.1.1
  libyaml = True

It seems the only notable difference between my last post when the bug was occurring and today is that I must’ve updated ansible core package along the way.

Is there anything I can do to help your team narrow it down? Although I now suspect the issue must be quite unique combination of versions of various elements, that seem to be incompatible??

What you said is absolutely right it seems. For some combination of versions, vscode API for autocompletion that involves insertText does not work. To support all of this, textEdit is also supposed to be used, which we missed. There’s a PR for this as well: https://github.com/ansible/ansible-language-server/pull/330/

Feel free to open this issue or a new one if you face a similar sort of problem with some other version combinations even after the following PR is merged and released!

1reaction
maciejdukcommented, May 19, 2022

Hi, just an update. I am working today from the same machine, not sure what has changed but this bug has gone away. Now, upon pressing enter, the line autocompletes and cursor moves to the next line indented (as expected).

VSC:

Version: 1.67.1
Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d
Date: 2022-05-06T12:37:14.619Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.4.0

Ansible: v0.9.0 preview

Ansible & ansible-lint:

└─$ ansible-lint --version
WARNING: PATH altered to include /opt/homebrew/Cellar/ansible-lint/6.0.2/libexec/bin
ansible-lint 6.0.2 using ansible 2.12.3
                                                                                                                                                                    
┌──(maciej㉿Maciej's-Maccy-Air)-[~/DevOps/ip-ansible-servicenow]
└─$ ansible --version
ansible [core 2.12.4]
  config file = /Users/maciej/.ansible/ansible.cfg
  configured module search path = ['/Users/maciej/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/5.6.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/maciej/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.10.2 (main, Feb  2 2022, 05:51:25) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.1.1
  libyaml = True

It seems the only notable difference between my last post when the bug was occurring and today is that I must’ve updated ansible core package along the way.

Is there anything I can do to help your team narrow it down? Although I now suspect the issue must be quite unique combination of versions of various elements, that seem to be incompatible??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio IntelliCode Whole line completions
When the user is typing, we show whole line completions which can be accepted by "Tab to accept". To dismiss the prediction, you...
Read more >
Tab autocomplete in Visual Studio Code doesn't work
Open Visual Study Code Setting. Enable Tab Completion.
Read more >
nvim-cmp deletes the first word after autocomplete. - Reddit
This only happens when the completion comes from the LSP. Completions from buffer text do not replace the word after the autocompleted one....
Read more >
Select an item in vim autocomplete list without inserting line ...
I understand from your question that you're in state 2 (since you've pressed arrow keys to find a completion). However, the default behavior...
Read more >
How to use Cmd's tab autocomplete effectively? - Super User
The way Bash's autocomplete works is that the tab key expands only if there is a unique expansion. Otherwise, nothing happens, but you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found