VS Code tab completion behavior more similar to bash/ python/ ipython (among many)

I am going to give this example in Python, but the concept is the same for every language

Suppose one has defined two variables

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>myvariablewithalongname_1=1
myvariablewithalongname_2=2
</code>
<code>myvariablewithalongname_1=1 myvariablewithalongname_2=2 </code>
myvariablewithalongname_1=1
myvariablewithalongname_2=2

In a bash/python/ipython/julia console, if one starts typing myvariablewith and then presses TAB, the text will be completed up to myvariablewithalongname_ and will show the options on how to finish the autocomplete. If there is only one option left, it completes with it.

Moreover, in the console, tab completion also works after a period, so doing np. TAB will show all the options of numpy.

VS Code tab completion works in a different way. In the first case, after typing myvariablewith and clicking TAB it will autocomplete to myvariablewithalongname_1, pressing TAB again will circulate among the options (without ever showing all of them). In VS Code, tab completion does not work after a period, so np. TAB will just add a tabular space. If one wants to see all the options, one has to press CTRL + Space.

VS Code also has a suggestion after special characters and a quick suggestion, but I find both of them very annoying. It creates too much noise for me.

What I want is pretty simple to describe:

  • if there is only one option, tab completion should complete the option
  • if there are multiple options, tab completion should display all of them (and ideally, complete the part of the predicate that matches all the options)
  • this should work at any place except in places where one is just trying to include a tab, like in the beginning of a line or after a tab.

What I was able to achieve so far:

After a lot of try and error, I figured that including

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> {
"key": "tab",
"command": "editor.action.triggerSuggest",
"when": "atEndOfWord && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
},
</code>
<code> { "key": "tab", "command": "editor.action.triggerSuggest", "when": "atEndOfWord && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'" }, </code>
    {
        "key": "tab",
        "command": "editor.action.triggerSuggest",
        "when": "atEndOfWord && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
    }, 

in my keybinding allows me to get the suggestions to be triggered by TAB without having to press CTRL + Space. What it does not get me is:

  • it shows me the suggestion even when there is only one suggestion
  • it does not complete up to the predicate (at this point, more like a nice to have)
  • it does not work after a period or any other character. The when condition “atEndOFWord” is what allows me to still maintain the customary behavior of tab in the beginning of a line.

Does anyone have a suggestion?

I tried figuring out by myself, but there is so little documentation. ChatGPT was not really helpfull. I keep imagining that someone else out there must have the same desire as mine, but I don’t even know how to look for it.

New contributor

Raphael Chinchilla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật