-
Notifications
You must be signed in to change notification settings - Fork 29k
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
code-completion doesn't replace expected text when cursor is not at the end of name #10266
Comments
@jrieken is there anything special I need to do to achieve this? |
If it helps, my Dart extension seems to handle this correctly: You can provide a |
I don't :-(. I can reconstruct this using may be model API but I was hoping not being forced to do this and @jrieken knows a better way. If we need this information to handle cases like this then it should IMO come from the tsserver since he has the full knowledge about the context of the code complete. |
When a completion item doesn't specify a text edit we construct one with the word range until the current position. So, you can achieve the behaviour using a different range or we just change our default - tho that makes it sound more like a user option cos I am not sure if overwrite after is always the right thing to do? |
Changing the default is not a good thing to do since we will break others. I will see if I can recompute this for now and make a request against the tsserver to better provide this info. |
You can always ask for the word range at position. That's usually a pretty good guess |
Agree. |
Related to #4878 ? |
Your understanding is wrong - when extensions provide a range nothing will change. |
Ok, then I'm confused - why hold it back? It sounds like rolling it out will have no change in behaviour at all, and a change will only come when extensions update to the new API (which they can't do until after you ship it)? |
We wanted to make sure that at least the extensions that ship with VS support this. Otherwise we should ship a setting that's not doing anything. |
Got it, thanks 👍 |
@bmewburn re #10266 (comment). This is good feedback and wrt insert I would say that it's OK to end up with invalid code, e.g having |
…en suggestion doesn't what you expect, #10266
We not gotten enough feedback to finalise this API and will push things out for another milestone. Tho, the setting and the default behaviour will ship. |
isnt this covered with |
Steps to Reproduce:
methodOne
methodTwo()
d
andT
and invoke completionmethodOne
from the completion listYou would expect
methodTwo
to be replaced withmethodOne
but you end up withmethodOneTwo
.The text was updated successfully, but these errors were encountered: