mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't mark the PSI element created by PsiAnnotationStubImpl as generated code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -677,6 +677,16 @@ public class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements Ps
|
||||
return psiAnnotation;
|
||||
}
|
||||
|
||||
public PsiAnnotation createAnnotationFromText(@NotNull final String annotationText,
|
||||
@Nullable final PsiElement context,
|
||||
boolean markGenerated) throws IncorrectOperationException {
|
||||
final PsiAnnotation psiAnnotation = super.createAnnotationFromText(annotationText, context);
|
||||
if (markGenerated) {
|
||||
GeneratedMarkerVisitor.markGenerated(psiAnnotation);
|
||||
}
|
||||
return psiAnnotation;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiCodeBlock createCodeBlockFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException {
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiJavaParserFacade;
|
||||
import com.intellij.psi.impl.PsiElementFactoryImpl;
|
||||
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
|
||||
import com.intellij.psi.impl.java.stubs.PsiAnnotationStub;
|
||||
import com.intellij.psi.impl.source.CharTableImpl;
|
||||
@@ -63,7 +64,9 @@ public class PsiAnnotationStubImpl extends StubBase<PsiAnnotation> implements Ps
|
||||
String text = getText();
|
||||
try {
|
||||
PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
|
||||
annotation = facade.createAnnotationFromText(text, getPsi());
|
||||
annotation = facade instanceof PsiElementFactoryImpl
|
||||
? ((PsiElementFactoryImpl) facade).createAnnotationFromText(text, getPsi(), false)
|
||||
: facade.createAnnotationFromText(text, getPsi());
|
||||
myParsedFromRepository = new SoftReference<>(annotation);
|
||||
return annotation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user