mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
WEB-46838 WEB-41768 WEB-47551 Commit document after template expansion in case of multiple carets
IDEA-CR-68587 GitOrigin-RevId: f88a3f15cb8daa2bf096dd06b6d82908c189bb46
This commit is contained in:
committed by
intellij-monorepo-bot
parent
816e9df618
commit
5bb31077db
@@ -63,6 +63,9 @@ public class CustomTemplateCallback {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method may return outdated PSI on uncommitted document.
|
||||
*/
|
||||
@NotNull
|
||||
public PsiElement getContext() {
|
||||
return getContext(myFile, getOffset(), myInInjectedFragment);
|
||||
|
||||
@@ -124,9 +124,6 @@ public class TemplateManagerImpl extends TemplateManager implements Disposable {
|
||||
if (runnable != null) {
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(editor.getDocument());
|
||||
runnable.run();
|
||||
if (editor.getCaretModel().getCaretCount() > 1) {
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(editor.getDocument());
|
||||
}
|
||||
}
|
||||
return runnable != null;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,9 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
|
||||
}
|
||||
try {
|
||||
expand(key, callback, defaultGenerator, Collections.emptyList(), true, Registry.intValue("emmet.segments.limit"));
|
||||
if (callback.getEditor().getCaretModel().getCaretCount() > 1) {
|
||||
PsiDocumentManager.getInstance(callback.getProject()).commitDocument(callback.getEditor().getDocument());
|
||||
}
|
||||
}
|
||||
catch (EmmetException e) {
|
||||
CommonRefactoringUtil.showErrorHint(callback.getProject(), callback.getEditor(), e.getMessage(), XmlBundle.message("emmet.error"), "");
|
||||
|
||||
Reference in New Issue
Block a user