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

After accepting suggestion with "overwriteOnAccept" one (next) char is removed #83400

Closed
svipas opened this issue Oct 28, 2019 · 18 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug suggest IntelliSense, Auto Complete verified Verification succeeded
Milestone

Comments

@svipas
Copy link
Contributor

svipas commented Oct 28, 2019

  • VSCode Version: 1.40.0 (29ffbfe3f1c21b01a2d0670170855669dd2b3b4f)
  • OS Version: macOS

Steps to Reproduce:

  1. Add "editor.suggest.overwriteOnAccept": true in settings.
  2. Use suggestion widget to auto-complete existing code and you will see that very often it will remove next char.

For e.g. write document.() and move cursor between . and ( and try to auto-complete something for e.g. getAnimations instead of document.getAnimations() you will get document.getAnimations)

Remember this happens often, but not every time, just try and I'm sure you will be able to reproduce the problem.

/cc @jrieken

@jrieken jrieken self-assigned this Oct 28, 2019
@jrieken jrieken added the info-needed Issue requires more information from poster label Oct 28, 2019
@jrieken
Copy link
Member

jrieken commented Oct 28, 2019

I cannot reproduce... (tried with JS)

@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug suggest IntelliSense, Auto Complete and removed info-needed Issue requires more information from poster labels Oct 28, 2019
@jrieken jrieken added this to the October 2019 milestone Oct 28, 2019
@jrieken
Copy link
Member

jrieken commented Oct 28, 2019

never mind - I can reproduce...

@jrieken
Copy link
Member

jrieken commented Oct 28, 2019

This is actually very similar to #66187. The issue is that the default replace/insert ranges are computed "after" the completion have be computed. If you are either typing fast or if completions are slow then the document contains one more character after completions have been computed. That breaks things. The fix is to compute the default ranges upfront.

@svipas
Copy link
Contributor Author

svipas commented Oct 28, 2019

Thanks for explaining it and fixing. Good work!

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

@jrieken Unfortunately issue still exists.

Screen Recording 2019-10-29 at 16 24 05

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

Unfortunately I cannot use a gif as input. I also wonder what version of TypeScript (I assume) offers word base suggestions at that place? Is that an extension?

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

I'm using JavaScript and TypeScript Nightly (3.8.20191026) extension with VS Code insiders.

interface CheckoutOrderDetailsProps {
  data: CartItem[];
  currencyCode: CurrencyCode;
  languageCode: LanguageEnum;
  totalPrice: string;
  children?: ReactNode;
}

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

I stil don't see word based suggests there. Sure that there is no other extension involved?

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

Yes.

Screenshot 2019-10-29 at 18 00 05

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

@jrieken I know how to reproduce it.

interface Props {
  totalPrice: string;
}

const totalPrice = `${totalPrice}`

Try now to remove totalPrice from interface and use auto-complete. You need to do that several times, because it's a little bit harder to repro, but still possible like earlier.

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

Try now to remove totalPrice from interface and use auto-complete.

Not sure what that means. Can provide step by step what you are doing?

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

  1. Create a new Untitled TS file.

  2. Copy-paste this:

interface Props {
  totalPrice: string;
}

const totalPrice = `${totalPrice}`
  1. Remove totalPrice from interface to look like this:
interface Props {
 : string;
}

const totalPrice = `${totalPrice}`
  1. Use suggestion widget to auto-complete the totalPrice near : string.

Try 3 and 4 step several times.

GIF:

Screen Recording 2019-10-29 at 18 28 25

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

idk what's going on here, I don't get word based suggestions because typescript always proposed readonly which then mutes word based suggestions. Any change you have those filtered?

Screenshot 2019-10-29 at 17 39 30

Anyways, I do have a theory. This is the same problem just in a different place. Word based suggestions are computed on a web worker (not on the extension host process) and there we have the same problem: first suggestions, then defaults are computed and therefore words from a later state are used.

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

Pushed another change. Next try tomorrow

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

I'm using VS Code Insiders (b7b21844e760e632f39bedf651da2bc93f54b0cc) with extensions mentioned above. I don't have any custom configurations, etc.

Thanks, I will try to test it tomorrow.

@svipas
Copy link
Contributor Author

svipas commented Oct 29, 2019

Screenshot 2019-10-29 at 18 56 32

I don't know if this helps in any case, but seems I don't get kind 17 or label readonly.

@jrieken
Copy link
Member

jrieken commented Oct 29, 2019

That's just the first round: It's usually snippets, then extensions (TS in this case), then and only when the former didn't produce a result it's word-suggestions

@aeschli aeschli added the verified Verification succeeded label Oct 31, 2019
@aeschli
Copy link
Contributor

aeschli commented Oct 31, 2019

Feature that caused the issue got reverted.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 16, 2019
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 suggest IntelliSense, Auto Complete verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants