mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[mod-commands] PsiUpdateImpl: set original file for code style settings
GitOrigin-RevId: a97779a8674bc00b0fb9787f98913e1d71c273c3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
895ba65ec6
commit
3c5f1db918
@@ -223,22 +223,26 @@ final class PsiUpdateImpl {
|
||||
}
|
||||
|
||||
private static @NotNull PsiFile copyFile(Project project, PsiFile origFile) {
|
||||
PsiFile file;
|
||||
var manager = InjectedLanguageManager.getInstance(project);
|
||||
boolean injectedFragment = manager.isInjectedFragment(origFile);
|
||||
if (!injectedFragment) {
|
||||
PsiElement navigationElement = origFile.getNavigationElement();
|
||||
if (navigationElement != origFile && navigationElement instanceof PsiFile) {
|
||||
return (PsiFile)navigationElement.copy();
|
||||
file = (PsiFile)navigationElement.copy();
|
||||
}
|
||||
else {
|
||||
file = (PsiFile)origFile.copy();
|
||||
}
|
||||
return (PsiFile)origFile.copy();
|
||||
}
|
||||
else {
|
||||
PsiFile file = PsiFileFactory.getInstance(project).createFileFromText(
|
||||
file = PsiFileFactory.getInstance(project).createFileFromText(
|
||||
origFile.getName(), origFile.getLanguage(), manager.getUnescapedText(origFile),
|
||||
false, true, true, origFile.getVirtualFile());
|
||||
file.putUserData(ORIGINAL_FILE_FOR_INJECTION, origFile);
|
||||
return file;
|
||||
}
|
||||
file.putUserData(PsiFileFactory.ORIGINAL_FILE, origFile);
|
||||
return file;
|
||||
}
|
||||
|
||||
private static class ModPsiUpdaterImpl implements ModPsiUpdater, DocumentListener, Disposable {
|
||||
|
||||
Reference in New Issue
Block a user