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

Single-char-prefix snippet suggestion is not case sensitive #139796

Open
constituent opened this issue Dec 27, 2021 · 4 comments
Open

Single-char-prefix snippet suggestion is not case sensitive #139796

constituent opened this issue Dec 27, 2021 · 4 comments
Assignees
Labels
suggest IntelliSense, Auto Complete under-discussion Issue is under discussion for relevance, priority, approach

Comments

@constituent
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:1.63.2
  • OS Version:Windows 10

Almost same as issue 8070, in which the reported bug has been fixed. However, if the snippet prefix is a single char, suggestion remains case insensitive.

For example, if I define a Result snippet with prefix Re and return snippet with prefix re, while typing re, return will be the first suggestion. But if the prefix is R and r respectively, Result will be on top while typing r.

@jrieken jrieken added info-needed Issue requires more information from poster snippets labels Jan 3, 2022
@jrieken
Copy link
Member

jrieken commented Jan 3, 2022

Please provide a minimal reproducable set of snippets and sample code

@constituent
Copy link
Author

Please provide a minimal reproducable set of snippets and sample code

  1. Add the following two snippets to global.code-snippets
"Return": {
	"prefix": [
		"r",
	],
	"body": [
		"return "
	],
	"description": "Return"
},
"Result": {
	"prefix": [
		"R"
	],
	"body": [
		"Result<$0>"
	],
	"description": "Result"
},
  1. Type r in vs code

expected: Return is the first snippet suggestion
observed: Result is the first snippet suggestion

Thanks for your attention!

@jrieken jrieken added suggest IntelliSense, Auto Complete under-discussion Issue is under discussion for relevance, priority, approach and removed info-needed Issue requires more information from poster snippets labels Jan 4, 2022
@jrieken
Copy link
Member

jrieken commented Jan 5, 2022

Thanks for updating/clarifying. Yes, match-scoring isn't case-sensitive towards lower-case characters, only towards upper-case characters. The logic is that lower-case characters are "the default", e.g you don't need to press another extra characters and that usually lower-case matches inside suggestions are worth less. I am not sure that we can improve this. What might help you is the "editor.tabCompletion": "on" setting - with that you can keep pressing Tab to cycle through suggestions after accepting

@constituent
Copy link
Author

As issue 8070 appears, I thought snippet selections are case sensitive by design. If it is somewhat complicated match-scoring algorithm, I think I can bear with an extra tab for return .

For in fact Result<$0> is only defined for a few languages (e.g. "scope": "rust"), while return for all languages, I need an extra tab only for those languages that defined Result<$0> if I want return . It will sure be a bit annoying. Or maybe I should change the prefix to re.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggest IntelliSense, Auto Complete under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

2 participants