You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
code-completion doesn't replace expected text when cursor is not at the end of name #10266
You can provide a textEdit property on the CompletionItem with a Range to replace. The Dart language service I'm using already returned the correct length here so it just worked out of the box. I guess in your MyCompletionItem class you may need to set up the textEdit (assuming you have all the necessary info from the service).
I don't :-(. I can reconstruct this using may be model API but I was hoping not being forced to do this and Johannes Rieken (@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.
Johannes Rieken (@jrieken) and I discussed that again over lunch and we agreed that we should investigate into a language neutral solution to not have to many language specific settings. Moving to September and adding Johannes Rieken (@jrieken) as an owner.
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.
Muah (@ctf0) that functionality only works if the language extension provides two ranges to VS Code. There's an issue tracking handling that for TS at #87091.
Activity
dbaeumer commentedon Aug 8, 2016
Johannes Rieken (@jrieken) is there anything special I need to do to achieve this?
DanTup commentedon Aug 8, 2016
If it helps, my Dart extension seems to handle this correctly:
https://github.com/DanTup/Dart-Code/blob/master/src/dart_completion_item_provider.ts#L41
You can provide a
textEditproperty on theCompletionItemwith aRangeto replace. The Dart language service I'm using already returned the correct length here so it just worked out of the box. I guess in yourMyCompletionItemclass you may need to set up thetextEdit(assuming you have all the necessary info from the service).dbaeumer commentedon Aug 8, 2016
I don't :-(. I can reconstruct this using may be model API but I was hoping not being forced to do this and Johannes Rieken (@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.
jrieken commentedon Aug 8, 2016
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?
dbaeumer commentedon Aug 8, 2016
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.
jrieken commentedon Aug 8, 2016
You can always ask for the word range at position. That's usually a pretty good guess
dbaeumer commentedon Aug 8, 2016
Agree.
dbaeumer commentedon Aug 26, 2016
Johannes Rieken (@jrieken) and I discussed that again over lunch and we agreed that we should investigate into a language neutral solution to not have to many language specific settings. Moving to September and adding Johannes Rieken (@jrieken) as an owner.
93 remaining items
jrieken commentedon Dec 2, 2019
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.
ctf0 commentedon Dec 20, 2019
isnt this covered with
"editor.suggest.insertMode": "replace"DanTup commentedon Dec 23, 2019
Muah (@ctf0) that functionality only works if the language extension provides two ranges to VS Code. There's an issue tracking handling that for TS at #87091.
move API proposal to stable API, #10266
fix compilos and adopt proposed api usage, #10266
AlGantori commentedon Feb 29, 2020