I want to replace call to deprecated com.intellij.openapi.actionSystem.DataKey#getData(com.intellij.openapi.actionSystem.DataProvider).
I found I can do that with:
Issue is that code in called inside com.intellij.codeInsight.completion.CompletionProvider#addCompletions which in turn runs on background thread.
If I call getDataContext inside UIUtil.invokeLaterIfNeeded this leads to predicable UI freeze.
Any suggestions how to change the flow to get rid of deprecated method usage ?
This a violation of abstraction basically, you always need to ask for values from DataContext, not from underlying providers. How did you get provider directly and why operate with them?
My usecase is user edits commit message from Git Log and I’m providing completion inside Edit Commit Message dialog.
Now, I need to know the commit being edited and I found that I can get it from Key<CommitMessage> DATA_KEY = Key.create("Vcs.CommitMessage.Panel");
CommitMessage is the provider in use.
So the question is: how to get DataContext inside completion provider running in background thread and not violate EDT usage without causing UI freeze.
Btw are there some docs describing getData deprecation and how to replace old usages ?