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

If there is a suggestions widget driven inline completion along with brackets and the user accepts it by hitting Tab, only the suggestions widget selection is accepted and the inline completion disappears #140176

Closed
juihanamshet1 opened this issue Jan 5, 2022 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster inline-completions
Milestone

Comments

@juihanamshet1
Copy link
Member

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

Version: 1.64.0-insider (user setup)
Commit: 9930557
Date: 2022-01-03T12:05:41.799Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

Steps to Reproduce:
pandas_sample.txt

  1. Convert the .txt file attached to a .py file
  2. Before
    image
  3. After I hit Tab, notnull would be accepted and the (x) would disappear.

I suspect this has something to do with how the diff is calculated when brackets are present/autoclosed.

In Python, when the inline completion contains a paren and when the paren is autoclosed by VS Code, this is the behavior. Notice that first the brackets get matched with the inline completion and THEN the inline completion disappears.

image1

If I delete the closing paren, the inline completion stays and works as expected including the Tab Tab behavior.
image2

However, I don't see the same issue in TypeScript always, for example
The prediction stays even if the bracket is autoclosed by VS Code. What's different here is that there is a semi-colon at the end of the prediction so there is text after the closing bracket.
image3

@juihanamshet1
Copy link
Member Author

cc @hediet

@hediet
Copy link
Member

hediet commented Jan 6, 2022

Thanks for reporting this!

Notice that first the brackets get matched with the inline completion and THEN the inline completion disappears.

Can you log the requests to your inline completion provider and what it sends back?
Are you sure that when your provider is asked at languages.apply(|) (with position being at |), that the model returns the correct inline suggestion (with correct ranges)?

Steps to Reproduce:

With which extension?

@hediet hediet added bug Issue identified by VS Code Team member as probable bug inline-completions labels Jan 6, 2022
@hediet hediet added this to the January 2022 milestone Jan 6, 2022
@hediet hediet added the info-needed Issue requires more information from poster label Jan 10, 2022
@hediet hediet modified the milestones: January 2022, On Deck Jan 10, 2022
@juihanamshet1
Copy link
Member Author

juihanamshet1 commented Jan 10, 2022

Hi Henning,

I've included the text and range for each of the scenarios below. Scenario 1 and 3 are the same except 1 is in Python and 3 is in Typescript; 1 doesn't work correctly but 3 does. Do these text and range look right to you?

This is with IntelliCode extension.

Scenario 1
In Python, when the inline completion contains a paren and when the paren is autoclosed by VS Code, this is the behavior. Notice that first the brackets get matched with the inline completion and THEN the inline completion disappears.
Cursor position: notNull = languages.apply(|)
Prediction Text: lambda x: x.notnull())
Prediction Range: char 34 - char 56 i.e. ()

image

Scenario 2
If I delete the closing paren, the inline completion stays and works as expected including the Tab Tab behavior.
Cursor position: notNull = languages.apply(|
Prediction Text: languages.apply(lambda x: x.notnull())
Prediction Range: char 18 - char 56 i.e. languages.apply(

image

Scenario 3
However, I don't see the same issue in TypeScript always, for example
The prediction stays even if the bracket is autoclosed by VS Code. What's different here is that there is a semi-colon at the end of the prediction so there is text after the closing bracket.
Cursor position: console.log(|)
Prediction Text: "");
Prediction Range: char 12 - char 16 i.e. ()

image

@hediet hediet modified the milestones: On Deck, January 2022 Jan 12, 2022
@hediet
Copy link
Member

hediet commented Jan 12, 2022

Prediction Range: char 34 - char 56 i.e. ()

This I don't full understand. With prediction range you mean the range that is to be replaced? In that example, you are replacing 22 characters (56 - 34), but () are only two.

I think due to the complexity of this, I can help you better in a quick meeting.

@hediet hediet modified the milestones: January 2022, On Deck Jan 12, 2022
@juihanamshet1
Copy link
Member Author

juihanamshet1 commented Jan 25, 2022

Adding discussions from our meeting last week so this issue is reopened by the bot.

The current line is notNull = languages.apply(|), the prediction is lambda x: x.notnull()). The cursor position is Column 35 which translates to position.character=34 I believe.

If the range to replace is set to char 34 - char 35, then the prediction does not show in grey text.

If the range to replace is set to char 34 - char 34, then the prediction shows up but the brackets don't match notNull = languages.apply(lambda x: x.notnull())) where the grey text is lambda x: x.notnull()). There is an extra bracket showing up because the last bracket doesn't match up.

@hediet
Copy link
Member

hediet commented Jan 26, 2022

Let's track that issue here: #141550

@juihanamshet1
Copy link
Member Author

Sounds good!

@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2022
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 info-needed Issue requires more information from poster inline-completions
Projects
None yet
Development

No branches or pull requests

4 participants
@jrieken @hediet @juihanamshet1 and others