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

Intellisense dismisses inline completions even if intellisense selected item and inline completion prefix match #170527

Closed
juihanamshet1 opened this issue Jan 3, 2023 · 10 comments · Fixed by #172422 or #179988
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug inline-completions verified Verification succeeded
Milestone

Comments

@juihanamshet1
Copy link
Member

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

  • VS Code Version: 1.74.2
  • OS Version:

Steps to Reproduce:

  1. Use the project in https://github.com/microsoft/vscode-extension-samples/tree/main/inline-completions. In the extension.ts, enable completeBracketPairs.
    image

  2. Run the project

  3. Open an empty .ts file and type [0,*):if (var) {

  4. When you hit Enter, the prediction you see on the screen will be [0,*):if (var) {}. Note the curly brace is closed.

  5. Now type along the prediction, when you type v, Intellisense will select var but despite this, the prediction gets dismissed. The expected behavior is that inline prediction stays because Intellisense item is the same.
    intellisense inline brackets sample ext repro

  6. This bug happens specifically when there are brackets are autoclosed by completeBracketPairs. I investigated further and noticed this condition was returning false. For the above example, the augmentedCompletion.range was [4,6]->[4,7] whereas the suggestInlineCompletion.range was [4,6]->[4,6].
    My suspicion for why augmentedCompletion.range was ending with [4,7] was that it's because 1 brace was added by completeBracketPairs, the range is incremented by 1. But even if completeBracketPairs adds 2 braces, the range remains [4,7].

cc @hediet

@juihanamshet1
Copy link
Member Author

You want these two internal settings enabled in settings.json btw
"editor.inlineSuggest.allowQuickSuggestions": true,
"editor.inlineSuggest.allowSuggestOnTriggerCharacters": true,

@jrieken jrieken assigned hediet and unassigned jrieken Jan 4, 2023
@hediet hediet added this to the January 2023 milestone Jan 4, 2023
@hediet hediet added bug Issue identified by VS Code Team member as probable bug inline-completions labels Jan 4, 2023
@juihanamshet1
Copy link
Member Author

I did some more investigation.
The augmentedCompletion.range was ending with [4,7] because the buffer text was if (v) so that makes sense.

I noticed another place where the augmentedCompletion.range.equalsRange(suggestInlineCompletion.range) causes an issue
image

image

console is in the Intellisense menu but doesn't get preselected. Here, the augmentedCompletion.range is [2,1] -> [2,6] whereas the suggestInlineCompletion.range was [2,6] -> [2,6].

@ayim
Copy link

ayim commented Jan 24, 2023

Hey folks, happy new year.
Checking in here to help with planning on our end - @hediet are we in a spot to say whether this will make it in for Jan 2023 iteration? It's the last issue before we go to market.

-A

@ayim
Copy link

ayim commented Jan 25, 2023

As per convo between Henning & Jui: the behaviour will be redesigned, this issue hasn't been looked at yet:

#172029

@hediet hediet added feature-request Request for new features or functionality bug Issue identified by VS Code Team member as probable bug and removed bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality labels Jan 25, 2023
hediet added a commit that referenced this issue Jan 25, 2023
@hediet
Copy link
Member

hediet commented Jan 25, 2023

This particular situation was not supported before, also the docs stated that this wouldn't work.

Anyway, I changed it sligthly so that this case should work now. I also fixed some other issues (regarding suggest widget preselection).

hediet added a commit that referenced this issue Jan 25, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jan 25, 2023
hediet added a commit that referenced this issue Jan 26, 2023
@jrieken jrieken added the verification-steps-needed Steps to verify are needed for verification label Jan 26, 2023
@rzhao271 rzhao271 added the verified Verification succeeded label Jan 27, 2023
@rzhao271
Copy link
Contributor

rzhao271 commented Jan 27, 2023

  1. Set editor.inlineSuggest.enabled to true, and set the settings listed in Intellisense dismisses inline completions even if intellisense selected item and inline completion prefix match #170527 (comment) in the user settings JSON file, because they don't show up in the Settings editor.
  2. Use the inline completions sample extension from vscode-extension-samples. I had to made sure the extension sample was using the proposed inlineCompletionsAdditions API and use npx vscode-dts dev and npx vscode-dts main to fetch the newest APIs.
  3. Run the extension.
  4. Create a new ts file and type // [0,*):if (var) {. Press enter, and an inline completion should show up.
  5. Type if (v. 🐛 The inline completion collapses.

@rzhao271 rzhao271 reopened this Jan 27, 2023
@rzhao271 rzhao271 added verification-found Issue verification failed and removed verified Verification succeeded verification-steps-needed Steps to verify are needed for verification labels Jan 27, 2023
@rzhao271 rzhao271 modified the milestones: January 2023, February 2023 Jan 27, 2023
@vscodenpa vscodenpa removed the insiders-released Patch has been released in VS Code Insiders label Jan 27, 2023
@juihanamshet1
Copy link
Member Author

I ran the repro steps in the latest Insiders
Version: 1.75.0-insider (user setup)
Commit: b229eb5
Date: 2023-01-27T22:17:10.413Z

The bug that I had initially reported seems to have been fixed however, it didn't fix the problem entirely.
issue_170527_repro

When I type v, inline and intellisense stay but when I finish typing var, inline gets dismissed.

@juihanamshet1
Copy link
Member Author

This particular situation was not supported before, also the docs stated that this wouldn't work.

Anyway, I changed it sligthly so that this case should work now. I also fixed some other issues (regarding suggest widget preselection).

@hediet The case of "when inline completion is on the screen and the user overtypes, intellisense should show with the prefix of the inline completion pre-selected in intellisense" is supported by the two hidden settings ("editor.inlineSuggest.allowQuickSuggestions": true, "editor.inlineSuggest.allowSuggestOnTriggerCharacters": true). The bug I filed is a subset of this.

@hediet hediet modified the milestones: February 2023, March 2023 Feb 20, 2023
@hediet hediet modified the milestones: March 2023, April 2023 Mar 20, 2023
hediet added a commit that referenced this issue Apr 14, 2023
@hediet
Copy link
Member

hediet commented Apr 14, 2023

Can be reproduced in the playground:

chrome_VMasOdHcUR

Fixed in upcoming version (just select the newest version in the playground):
IUAqPtKBRq

hediet added a commit that referenced this issue Apr 17, 2023
hediet added a commit that referenced this issue Apr 17, 2023
hediet added a commit that referenced this issue Apr 17, 2023
@roblourens roblourens removed the verification-found Issue verification failed label Apr 28, 2023
@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Apr 28, 2023
@TylerLeonhardt
Copy link
Member

Recording 2023-04-28 at 16 35 54
looks correct to me!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug inline-completions verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants