easy debug info.lineNumber: replace lineInfo/settingInfo/fileInfo to info

This commit is contained in:
林万程
2023-12-20 18:26:49 +08:00
parent 249a43a6e8
commit ed33a94fcc
25 changed files with 211 additions and 207 deletions

View File

@@ -30,18 +30,18 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentJava;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentJava;
}
@Override
public @Nullable <T extends SettingsInfo> String treeDoc(@NotNull T settingsInfo, ProjectViewNode<?> node,
public @Nullable <T extends SettingsInfo> String treeDoc(@NotNull T info, ProjectViewNode<?> node,
@NotNull Project project) {
return JavaTree.treeDoc(settingsInfo, node, project);
return JavaTree.treeDoc(info, node, project);
}
@Override
protected @Nullable String refDoc(@NotNull LineInfo lineInfo, @NotNull PsiElement ref) {
protected @Nullable String refDoc(@NotNull LineInfo info, @NotNull PsiElement ref) {
if ("Override".equals(ref.getText())) {
@Nullable PsiMethod psiMethod = PsiTreeUtil.getParentOfType(ref, PsiMethod.class);
if (psiMethod == null) {
@@ -49,47 +49,47 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
}
// must supper
@Nullable PsiDocComment psiDocComment = OwnerToPsiDocUtils.supperMethodDoc(psiMethod);
return docElementToStr(lineInfo, psiDocComment);
return docElementToStr(info, psiDocComment);
}
if (lineInfo.appSettings.fromNew) {
if (info.appSettings.fromNew) {
PsiElement parent = ref.getParent();
if (parent instanceof PsiNewExpression) {
@NotNull PsiNewExpression psiNewExpression = (PsiNewExpression) parent;
try {
@Nullable PsiMethod resolve = psiNewExpression.resolveMethod();
if (resolve != null) {
return resolveDocPrint(lineInfo, resolve);
return resolveDocPrint(info, resolve);
}
} catch (Throwable ignore) {
// ignore
}
}
}
return super.refDoc(lineInfo, ref);
return super.refDoc(info, ref);
}
@Override
public @Nullable <T extends SettingsInfo> String resolveDocPrint(@NotNull T settingsInfo, @NotNull PsiElement resolve) {
@Nullable String resolveDocPrint = super.resolveDocPrint(settingsInfo, resolve);
public @Nullable <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
@Nullable String resolveDocPrint = super.resolveDocPrint(info, resolve);
if (resolveDocPrint != null) {
return resolveDocPrint;
}
// no doc comment support get set
if (parseBaseComment(settingsInfo) && resolve instanceof PsiMethod) {
if (parseBaseComment(info) && resolve instanceof PsiMethod) {
@Nullable PsiField psiField = PsiMethodToPsiDoc.propMethodField((PsiMethod) resolve);
if (psiField != null) {
return super.resolveDocPrint(settingsInfo, psiField);
return super.resolveDocPrint(info, psiField);
}
}
if (settingsInfo.appSettings.fromParam && resolve instanceof PsiParameter) {
if (info.appSettings.fromParam && resolve instanceof PsiParameter) {
return paramDoc((PsiParameter) resolve);
}
return null;
}
@Override
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T settingsInfo) {
return settingsInfo.appSettings.showLineEndCommentJavaBase;
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T info) {
return info.appSettings.showLineEndCommentJavaBase;
}
@Nullable
@@ -118,18 +118,18 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
@Nullable
@Override
protected <T extends SettingsInfo> PsiDocComment toDocElement(@NotNull T settingsInfo,
protected <T extends SettingsInfo> PsiDocComment toDocElement(@NotNull T info,
@NotNull PsiElement resolve) {
if (resolve instanceof PsiDocCommentOwner) {
@NotNull PsiDocCommentOwner psiDocCommentOwner = (PsiDocCommentOwner) resolve;
return OwnerToPsiDocSkip.refDoc(settingsInfo, psiDocCommentOwner);
return OwnerToPsiDocSkip.refDoc(info, psiDocCommentOwner);
}
return null;
}
@NotNull
@Override
protected <T extends SettingsInfo> String descDoc(@NotNull T lineInfo, @NotNull PsiDocComment psiDocComment) {
protected <T extends SettingsInfo> String descDoc(@NotNull T info, @NotNull PsiDocComment psiDocComment) {
@NotNull StringBuilder sb = new StringBuilder();
int lineCount = 0;
@NotNull PsiElement[] elements = psiDocComment.getDescriptionElements();
@@ -137,7 +137,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
if (appendElementText(sb, element)) {
lineCount++;
}
if (DocFilter.lineCountOrLenOver(lineInfo, sb, lineCount)) {
if (DocFilter.lineCountOrLenOver(info, sb, lineCount)) {
break;
}
}
@@ -163,7 +163,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
}
@Override
protected <T extends SettingsInfo> void appendTag(@NotNull T lineInfo, @NotNull StringBuilder tagStrBuilder,
protected <T extends SettingsInfo> void appendTag(@NotNull T info, @NotNull StringBuilder tagStrBuilder,
@NotNull PsiDocComment psiDocComment, @NotNull String name) {
@NotNull PsiDocTag[] tags = psiDocComment.findTagsByName(name);
for (@NotNull PsiDocTag tag : tags) {

View File

@@ -23,21 +23,21 @@ public class JavaTree {
private JavaTree() {}
@Nullable
public static <T extends SettingsInfo> String treeDoc(@NotNull T settingsInfo, ProjectViewNode<?> node,
public static <T extends SettingsInfo> String treeDoc(@NotNull T info, ProjectViewNode<?> node,
@NotNull Project project) {
@Nullable PsiDocComment docComment = nodeDoc(settingsInfo, node, project);
@Nullable PsiDocComment docComment = nodeDoc(info, node, project);
if (docComment == null) {
return null;
}
@Nullable String s = JavaLangDoc.INSTANCE.docElementToStr(settingsInfo, docComment);
if (s != null && !DocSkip.skipDoc(settingsInfo, s)) {
@Nullable String s = JavaLangDoc.INSTANCE.docElementToStr(info, docComment);
if (s != null && !DocSkip.skipDoc(info, s)) {
return s;
}
return null;
}
@Nullable
static <T extends SettingsInfo> PsiDocComment nodeDoc(@NotNull T settingsInfo, ProjectViewNode<?> node,
static <T extends SettingsInfo> PsiDocComment nodeDoc(@NotNull T info, ProjectViewNode<?> node,
@NotNull Project project) {
if (node instanceof PsiFileNode) {
PsiFile psiFile = ((PsiFileNode) node).getValue();
@@ -56,7 +56,7 @@ public class JavaTree {
if (type instanceof PsiClassReferenceType) {
@NotNull PsiClassReferenceType psiClassReferenceType = (PsiClassReferenceType) type;
@NotNull PsiJavaCodeReferenceElement reference = psiClassReferenceType.getReference();
return NewCallRefToPsiDoc.javaCodeDoc(settingsInfo, reference);
return NewCallRefToPsiDoc.javaCodeDoc(info, reference);
}
}

View File

@@ -29,18 +29,18 @@ public class KotlinLangDoc extends BaseTagLangDoc<KDocSection> {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentKotlin;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentKotlin;
}
@Override
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T settingsInfo) {
return settingsInfo.appSettings.showLineEndCommentKotlinBase;
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T info) {
return info.appSettings.showLineEndCommentKotlinBase;
}
@Override
@Nullable
protected <T extends SettingsInfo> KDocSection toDocElement(@NotNull T settingsInfo, @NotNull PsiElement resolve) {
protected <T extends SettingsInfo> KDocSection toDocElement(@NotNull T info, @NotNull PsiElement resolve) {
if (resolve instanceof PsiPackageBase) {
return null;
}
@@ -53,18 +53,18 @@ public class KotlinLangDoc extends BaseTagLangDoc<KDocSection> {
@NotNull
@Override
protected <T extends SettingsInfo> String descDoc(@NotNull T lineInfo, @NotNull KDocSection kDocSection) {
protected <T extends SettingsInfo> String descDoc(@NotNull T info, @NotNull KDocSection kDocSection) {
@NotNull String content = kDocSection.getContent();
return DocFilter.cutDoc(content, lineInfo, false);
return DocFilter.cutDoc(content, info, false);
}
@Override
protected <T extends SettingsInfo> void appendTag(@NotNull T lineInfo, @NotNull StringBuilder tagStrBuilder,
protected <T extends SettingsInfo> void appendTag(@NotNull T info, @NotNull StringBuilder tagStrBuilder,
@NotNull KDocSection kDocSection, @NotNull String name) {
@NotNull List<KDocTag> tags = kDocSection.findTagsByName(name);
for (@NotNull KDocTag tag : tags) {
@NotNull String content = tag.getContent();
@NotNull String cutDoc = DocFilter.cutDoc(content, lineInfo, false);
@NotNull String cutDoc = DocFilter.cutDoc(content, info, false);
tagStrBuilder.append(cutDoc);
}
}

View File

@@ -16,7 +16,7 @@ public class NewCallRefToPsiDoc {
private NewCallRefToPsiDoc() {}
@Nullable
public static <T extends SettingsInfo> PsiDocComment javaCodeDoc(@NotNull T settingsInfo,
public static <T extends SettingsInfo> PsiDocComment javaCodeDoc(@NotNull T info,
@Nullable PsiJavaCodeReferenceElement ref) {
if (ref == null) {
return null;
@@ -28,7 +28,7 @@ public class NewCallRefToPsiDoc {
// ignore
}
if (resolve instanceof PsiDocCommentOwner) {
return OwnerToPsiDocSkip.refDoc(settingsInfo, ((PsiDocCommentOwner) resolve));
return OwnerToPsiDocSkip.refDoc(info, ((PsiDocCommentOwner) resolve));
}
return null;
}

View File

@@ -16,17 +16,17 @@ public class OwnerToPsiDocSkip {
private OwnerToPsiDocSkip() {}
@Nullable
public static <T extends SettingsInfo> PsiDocComment refDoc(@NotNull T settingsInfo,
public static <T extends SettingsInfo> PsiDocComment refDoc(@NotNull T info,
@Nullable PsiDocCommentOwner docOwner) {
if (docOwner == null) {
return null;
}
if (SkipUtils.skipSign(settingsInfo, docOwner)) {
if (SkipUtils.skipSign(info, docOwner)) {
return null;
}
@Nullable PsiDocComment docComment = docOwner instanceof PsiMethod
? OwnerToPsiDocUtils.methodDoc(((PsiMethod) docOwner))
: OwnerToPsiDocUtils.srcOrByteCodeDoc(docOwner);
return SkipUtils.skipDoc(settingsInfo, docComment);
return SkipUtils.skipDoc(info, docComment);
}
}

View File

@@ -15,20 +15,20 @@ class SkipUtils {
private SkipUtils() {}
static <T extends SettingsInfo> boolean skipSign(@NotNull T settingsInfo, PsiElement psiElement) {
@Nullable String text = psiName(settingsInfo, psiElement);
static <T extends SettingsInfo> boolean skipSign(@NotNull T info, PsiElement psiElement) {
@Nullable String text = psiName(info, psiElement);
if (text == null) {
return true;
}
return DocSkip.skipSign(settingsInfo, text);
return DocSkip.skipSign(info, text);
}
@Nullable
private static <T extends SettingsInfo> String psiName(@NotNull T settingsInfo, @Nullable PsiElement psiElement) {
private static <T extends SettingsInfo> String psiName(@NotNull T info, @Nullable PsiElement psiElement) {
if (psiElement instanceof PsiClass) {
@NotNull PsiClass psiClass = (PsiClass) psiElement;
if (settingsInfo.funcEnum == FuncEnum.LINE
&& settingsInfo.appSettings.skipAnnotation && psiClass.isAnnotationType()) {
if (info.funcEnum == FuncEnum.LINE
&& info.appSettings.skipAnnotation && psiClass.isAnnotationType()) {
return null;
}
return psiClass.getQualifiedName();
@@ -53,15 +53,15 @@ class SkipUtils {
}
@Nullable
static <T extends SettingsInfo> PsiDocComment skipDoc(@NotNull T settingsInfo, @Nullable PsiDocComment doc) {
static <T extends SettingsInfo> PsiDocComment skipDoc(@NotNull T info, @Nullable PsiDocComment doc) {
if (doc == null) {
return null;
}
if (settingsInfo.appSettings.skipBlank && isBlank(doc)) {
if (info.appSettings.skipBlank && isBlank(doc)) {
return null;
}
String text = doc.getText();
boolean skip = DocSkip.skipDoc(settingsInfo, text);
boolean skip = DocSkip.skipDoc(info, text);
return skip ? null : doc;
}

View File

@@ -69,8 +69,8 @@ public class LineEnd extends EditorLinePainter {
if (!file.exists()) {
return null;
}
@Nullable LineInfo lineInfo = LineInfo.of(file, project, lineNumber);
@Nullable String doc = lineDocSkipHave(lineInfo);
@Nullable LineInfo info = LineInfo.of(file, project, lineNumber);
@Nullable String doc = lineDocSkipHave(info);
if (doc == null) {
return null;
}
@@ -78,8 +78,8 @@ public class LineEnd extends EditorLinePainter {
|| file.getFileType().equals(Json5FileType.INSTANCE)
? settings.lineEndJsonTextAttr
: settings.lineEndTextAttr;
@NotNull LineExtensionInfo info = new LineExtensionInfo(settings.lineEndPrefix + doc, textAttr);
return Collections.singletonList(info);
@NotNull LineExtensionInfo lineExt = new LineExtensionInfo(settings.lineEndPrefix + doc, textAttr);
return Collections.singletonList(lineExt);
}
public static void textWithDoc(@NotNull FileInfo fileInfo, int startLine, int endLine,
@@ -88,15 +88,15 @@ public class LineEnd extends EditorLinePainter {
int size = endLine - startLine;
@NotNull StringBuilder sb = new StringBuilder();
for (int i = startLine; i <= endLine; i++) {
@Nullable LineInfo lineInfo = LineInfo.of(fileInfo, i);
if (lineInfo == null) {
@Nullable LineInfo info = LineInfo.of(fileInfo, i);
if (info == null) {
sb.append("\n");
continue;
}
sb.append(lineInfo.text);
@Nullable String doc = lineDocSkipHave(lineInfo);
sb.append(info.text);
@Nullable String doc = lineDocSkipHave(info);
if (doc != null) {
sb.append(lineInfo.appSettings.lineEndPrefix).append(doc);
sb.append(info.appSettings.lineEndPrefix).append(doc);
}
sb.append("\n");
indicator.setText2(i + " / " + size + " line");
@@ -110,27 +110,27 @@ public class LineEnd extends EditorLinePainter {
func.accept(sb.toString());
}
private static @Nullable String lineDocSkipHave(@Nullable LineInfo lineInfo) {
@Nullable String doc = lineDoc(lineInfo);
private static @Nullable String lineDocSkipHave(@Nullable LineInfo info) {
@Nullable String doc = lineDoc(info);
if (doc == null) {
return null;
}
@NotNull String trimDoc = doc.trim();
if (lineInfo.text.trim().endsWith(trimDoc)) {
if (info.text.trim().endsWith(trimDoc)) {
return null;
}
return trimDoc;
}
private static @Nullable String lineDoc(@Nullable LineInfo lineInfo) {
if (lineInfo == null) {
private static @Nullable String lineDoc(@Nullable LineInfo info) {
if (info == null) {
return null;
}
// override some text
@Nullable String doc = LineExt.doc(lineInfo);
@Nullable String doc = LineExt.doc(info);
if (doc != null) {
return doc;
}
return BaseLangDoc.langDoc(lineInfo);
return BaseLangDoc.langDoc(info);
}
}

View File

@@ -91,14 +91,14 @@ public class LineEndAdd extends DumbAwareAction {
}
private void addDoc(@NotNull Project project, @NotNull VirtualFile file, @NotNull ProgressIndicator indicator) {
@Nullable FileInfo fileInfo = FileInfo.of(file, project);
if (fileInfo == null) {
@Nullable FileInfo info = FileInfo.of(file, project);
if (info == null) {
return;
}
int startLine = 0;
int endLine = fileInfo.document.getLineCount() - 1;
LineEnd.textWithDoc(fileInfo, startLine, endLine, indicator, s ->
fileInfo.document.replaceString(0, fileInfo.document.getTextLength() - 1, s)
int endLine = info.document.getLineCount() - 1;
LineEnd.textWithDoc(info, startLine, endLine, indicator, s ->
info.document.replaceString(0, info.document.getTextLength() - 1, s)
);
}
}

View File

@@ -45,16 +45,16 @@ public class LineEndCopy extends DumbAwareAction {
if (project == null) {
return;
}
@Nullable FileInfo fileInfo = FileInfo.of(event);
if (fileInfo == null) {
@Nullable FileInfo info = FileInfo.of(event);
if (info == null) {
return;
}
new Task.Backgroundable(project, "Show LineEndCopy " + fileInfo.file.getName()) {
new Task.Backgroundable(project, "Show LineEndCopy " + info.file.getName()) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
ApplicationManager.getApplication().runReadAction(() -> {
int startLine = 0;
int endLine = fileInfo.document.getLineCount() - 1;
int endLine = info.document.getLineCount() - 1;
// if select
@Nullable Editor editor = event.getData(CommonDataKeys.EDITOR);
if (editor != null) {
@@ -62,13 +62,13 @@ public class LineEndCopy extends DumbAwareAction {
int start = primaryCaret.getSelectionStart();
int end = primaryCaret.getSelectionEnd();
try {
startLine = fileInfo.document.getLineNumber(start);
endLine = fileInfo.document.getLineNumber(end);
startLine = info.document.getLineNumber(start);
endLine = info.document.getLineNumber(end);
} catch (Exception e) {
return;
}
}
LineEnd.textWithDoc(fileInfo, startLine, endLine, indicator, s -> {
LineEnd.textWithDoc(info, startLine, endLine, indicator, s -> {
@NotNull StringSelection content = new StringSelection(s);
CopyPasteManager.getInstance().setContents(content);
});

View File

@@ -73,22 +73,22 @@ public class Tree implements ProjectViewNodeDecorator {
if (doc != null) {
return doc;
}
@NotNull SettingsInfo settingsInfo = SettingsInfo.of(project, FuncEnum.TREE);
@Nullable String relFileDoc = RelFileDoc.relFileDoc(node, settingsInfo);
@NotNull SettingsInfo info = SettingsInfo.of(project, FuncEnum.TREE);
@Nullable String relFileDoc = RelFileDoc.relFileDoc(node, info);
if (relFileDoc != null) {
return relFileDoc;
}
Object value = node.getValue();
if (value instanceof PsiElement) {
@NotNull PsiElement psiElement = (PsiElement) value;
@Nullable String docPrint = BaseLangDoc.resolveDoc(settingsInfo, psiElement);
@Nullable String docPrint = BaseLangDoc.resolveDoc(info, psiElement);
if (docPrint != null) {
return docPrint;
}
}
@NotNull Collection<BaseLangDoc> langDocs = BaseLangDoc.LANG_DOC_MAP.values();
for (@NotNull BaseLangDoc langDoc : langDocs) {
@Nullable String s = langDoc.treeDoc(settingsInfo, node, project);
@Nullable String s = langDoc.treeDoc(info, node, project);
if (s != null) {
return s;
}

View File

@@ -12,9 +12,9 @@ public class LineInfo extends FileInfo {
public final int endOffset;
public final @NotNull String text;
protected LineInfo(@NotNull FileInfo fileInfo, @NotNull String text,
protected LineInfo(@NotNull FileInfo info, @NotNull String text,
int lineNumber, int startOffset, int endOffset) {
super(fileInfo.file, fileInfo.document, fileInfo.project, fileInfo.viewProvider, FuncEnum.LINE);
super(info.file, info.document, info.project, info.viewProvider, FuncEnum.LINE);
this.lineNumber = lineNumber;
this.startOffset = startOffset;
this.endOffset = endOffset;
@@ -22,26 +22,26 @@ public class LineInfo extends FileInfo {
}
public static @Nullable LineInfo of(@NotNull VirtualFile file, @NotNull Project project, int lineNumber) {
@Nullable FileInfo fileInfo = of(file, project);
if (fileInfo == null) {
@Nullable FileInfo info = of(file, project);
if (info == null) {
return null;
}
return of(fileInfo, lineNumber);
return of(info, lineNumber);
}
public static @Nullable LineInfo of(@NotNull FileInfo fileInfo, int lineNumber) {
public static @Nullable LineInfo of(@NotNull FileInfo info, int lineNumber) {
// lineNumber start 0, as 1 <= 1 should return
if (fileInfo.document.getLineCount() <= lineNumber) {
if (info.document.getLineCount() <= lineNumber) {
return null;
}
try {
int startOffset = fileInfo.document.getLineStartOffset(lineNumber);
int endOffset = fileInfo.document.getLineEndOffset(lineNumber);
int startOffset = info.document.getLineStartOffset(lineNumber);
int endOffset = info.document.getLineEndOffset(lineNumber);
if (startOffset == endOffset) {
return null;
}
@NotNull String text = fileInfo.document.getText(new TextRange(startOffset, endOffset));
return new LineInfo(fileInfo, text, lineNumber, startOffset, endOffset);
@NotNull String text = info.document.getText(new TextRange(startOffset, endOffset));
return new LineInfo(info, text, lineNumber, startOffset, endOffset);
} catch (Exception e) {
return null;
}

View File

@@ -0,0 +1,4 @@
/**
* LineInfo > FileInfo > SettingsInfo
*/
package io.github.linwancen.plugin.show.bean;

View File

@@ -14,30 +14,30 @@ public class LineExt {
private LineExt() {}
public static @Nullable String doc(@NotNull LineInfo lineInfo) {
int i = lineInfo.text.indexOf(lineInfo.appSettings.lineEndPrefix);
@NotNull String code = i <= 0 ? lineInfo.text : lineInfo.text.substring(0, i);
@Nullable String extDoc = LineExt.extDoc(lineInfo, code);
public static @Nullable String doc(@NotNull LineInfo info) {
int i = info.text.indexOf(info.appSettings.lineEndPrefix);
@NotNull String code = i <= 0 ? info.text : info.text.substring(0, i);
@Nullable String extDoc = LineExt.extDoc(info, code);
if (extDoc == null) {
return null;
}
extDoc = extDoc.trim();
if (lineInfo.text.endsWith(extDoc)) {
if (info.text.endsWith(extDoc)) {
return null;
}
return extDoc;
}
@Nullable
public static String extDoc(@NotNull LineInfo lineInfo, @NotNull String code) {
@NotNull String path = lineInfo.file.getPath();
@NotNull String name = lineInfo.file.getName();
@Nullable String ext = lineInfo.file.getExtension();
public static String extDoc(@NotNull LineInfo info, @NotNull String code) {
@NotNull String path = info.file.getPath();
@NotNull String name = info.file.getName();
@Nullable String ext = info.file.getExtension();
@NotNull Map<String, Map<String, List<String>>> keyMap = ConfCache.keyMap(path, name, ext);
if (keyMap.isEmpty()) {
return null;
}
@Nullable Pattern pattern = ConfCache.pattern(lineInfo.project, keyMap, path);
@Nullable Pattern pattern = ConfCache.pattern(info.project, keyMap, path);
if (pattern == null || pattern.pattern().isEmpty()) {
return null;
}

View File

@@ -25,12 +25,12 @@ public class GoLangDoc extends BaseLangDoc {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentGo;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentGo;
}
@Override
public @Nullable <T extends SettingsInfo> String resolveDocRaw(@NotNull T lineInfo, @NotNull PsiElement resolve) {
public @Nullable <T extends SettingsInfo> String resolveDocRaw(@NotNull T info, @NotNull PsiElement resolve) {
@NotNull List<PsiComment> comments = GoDocumentationProvider.getCommentsForElement(resolve);
return GoDocumentationProvider.getCommentText(comments, false);
}

View File

@@ -23,12 +23,12 @@ public class JsLangDoc extends BaseLangDoc {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentJs;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentJs;
}
@Override
public @Nullable <T extends SettingsInfo> String resolveDocRaw(@NotNull T lineInfo, @NotNull PsiElement resolve) {
public @Nullable <T extends SettingsInfo> String resolveDocRaw(@NotNull T info, @NotNull PsiElement resolve) {
@Nullable PsiComment psiComment = JSDocumentationUtils.findOwnDocCommentForImplicitElement(resolve);
if (psiComment == null) {
return null;
@@ -37,8 +37,8 @@ public class JsLangDoc extends BaseLangDoc {
if (text != null) {
return text;
}
if (lineInfo.appSettings.showLineEndCommentJsBase) {
return super.resolveDocRaw(lineInfo, resolve);
if (info.appSettings.showLineEndCommentJsBase) {
return super.resolveDocRaw(info, resolve);
}
return null;
}

View File

@@ -34,13 +34,13 @@ public class JsonLangDoc extends BaseLangDoc {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentJson;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentJson;
}
@Override
public @Nullable String findRefDoc(@NotNull LineInfo lineInfo, @NotNull PsiElement element) {
@Nullable PsiElement start = lineInfo.viewProvider.findElementAt(lineInfo.startOffset);
public @Nullable String findRefDoc(@NotNull LineInfo info, @NotNull PsiElement element) {
@Nullable PsiElement start = info.viewProvider.findElementAt(info.startOffset);
if (start == null) {
return null;
}
@@ -48,16 +48,16 @@ public class JsonLangDoc extends BaseLangDoc {
if (jsonProperty == null) {
return null;
}
return refElementDoc(lineInfo, jsonProperty);
return refElementDoc(info, jsonProperty);
}
@Override
protected @Nullable String refDoc(@NotNull LineInfo lineInfo, @NotNull PsiElement ref) {
protected @Nullable String refDoc(@NotNull LineInfo info, @NotNull PsiElement ref) {
if (!(ref instanceof JsonProperty)) {
return null;
}
@NotNull JsonProperty jsonProperty = (JsonProperty) ref;
@Nullable String extDoc = extDoc(lineInfo, jsonProperty);
@Nullable String extDoc = extDoc(info, jsonProperty);
if (extDoc != null) {
return extDoc;
}
@@ -72,7 +72,7 @@ public class JsonLangDoc extends BaseLangDoc {
if (resolve == null) {
continue;
}
@Nullable String doc = BaseLangDoc.resolveDoc(lineInfo, resolve);
@Nullable String doc = BaseLangDoc.resolveDoc(info, resolve);
if (doc != null) {
return doc;
}
@@ -81,28 +81,28 @@ public class JsonLangDoc extends BaseLangDoc {
}
@Nullable
private static String extDoc(@NotNull LineInfo lineInfo, @NotNull JsonProperty prop) {
private static String extDoc(@NotNull LineInfo info, @NotNull JsonProperty prop) {
@Nullable JsonValue value = prop.getValue();
if (value == null || value instanceof JsonArray || value instanceof JsonObject) {
return null;
}
@NotNull GlobalSearchScope scope = GlobalSearchScope.allScope(lineInfo.project);
@NotNull GlobalSearchScope scope = GlobalSearchScope.allScope(info.project);
@NotNull String jsonKey = prop.getName();
String jsonValue = value.getText();
// Read the json.path before if needed
@Nullable String dictDoc = jsonDictDoc(lineInfo, scope, jsonKey, jsonValue);
@Nullable String dictDoc = jsonDictDoc(info, scope, jsonKey, jsonValue);
if (dictDoc != null) {
return dictDoc;
}
@NotNull Map<String, Map<String, List<String>>> jsonMap = ConfCache.jsonMap(lineInfo.file.getPath());
@NotNull Map<String, Map<String, List<String>>> jsonMap = ConfCache.jsonMap(info.file.getPath());
return GetFromDocMap.get(jsonMap, jsonKey);
}
@Nullable
private static String jsonDictDoc(@NotNull LineInfo lineInfo,
private static String jsonDictDoc(@NotNull LineInfo info,
@NotNull GlobalSearchScope scope, String jsonKey, String jsonValue) {
@NotNull String name = jsonKey + ".tsv";
@NotNull Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(lineInfo.project, name, scope);
@NotNull Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(info.project, name, scope);
// one file
if (files.size() < 2) {
for (@NotNull VirtualFile file : files) {
@@ -120,7 +120,7 @@ public class JsonLangDoc extends BaseLangDoc {
@NotNull Map<String, List<String>> map = TsvLoader.buildMap(file, false);
fileMap.put(file, map);
}
@NotNull String path = lineInfo.file.getPath();
@NotNull String path = info.file.getPath();
@NotNull SortedMap<String, Map<String, List<String>>> sortedMap = ConfCacheGetUtils.filterPath(fileMap, path);
return GetFromDocMap.get(sortedMap, jsonValue);
}

View File

@@ -27,18 +27,18 @@ public class PythonLangDoc extends BaseTagLangDoc<StructuredDocString> {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentPy;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentPy;
}
@Override
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T settingsInfo) {
return settingsInfo.appSettings.showLineEndCommentPyBase;
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T info) {
return info.appSettings.showLineEndCommentPyBase;
}
@Nullable
@Override
protected <T extends SettingsInfo> StructuredDocString toDocElement(@NotNull T settingsInfo,
protected <T extends SettingsInfo> StructuredDocString toDocElement(@NotNull T info,
@NotNull PsiElement resolve) {
if (resolve instanceof PyDocStringOwner) {
@NotNull PyDocStringOwner pyDocStringOwner = (PyDocStringOwner) resolve;
@@ -49,24 +49,24 @@ public class PythonLangDoc extends BaseTagLangDoc<StructuredDocString> {
@NotNull
@Override
protected <T extends SettingsInfo> String descDoc(@NotNull T lineInfo,
protected <T extends SettingsInfo> String descDoc(@NotNull T info,
@NotNull StructuredDocString structuredDocString) {
String summary = structuredDocString.getSummary();
if (StringUtils.isNotEmpty(summary)) {
return summary;
}
@NotNull String description = structuredDocString.getDescription();
return DocFilter.cutDoc(DocFilter.html2Text(description), lineInfo, false);
return DocFilter.cutDoc(DocFilter.html2Text(description), info, false);
}
@Override
protected <T extends SettingsInfo> void appendTag(@NotNull T lineInfo, @NotNull StringBuilder tagStrBuilder,
protected <T extends SettingsInfo> void appendTag(@NotNull T info, @NotNull StringBuilder tagStrBuilder,
@NotNull StructuredDocString structuredDocString,
@NotNull String name) {
if (structuredDocString instanceof TagBasedDocString) {
@Nullable Substring tagValue = ((TagBasedDocString) structuredDocString).getTagValue(name);
if (tagValue != null) {
@NotNull String cutDoc = DocFilter.cutDoc(tagValue.getValue(), lineInfo, false);
@NotNull String cutDoc = DocFilter.cutDoc(tagValue.getValue(), info, false);
tagStrBuilder.append(cutDoc);
}
}

View File

@@ -25,13 +25,13 @@ public class SqlLangDoc extends BaseLangDoc {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
return lineInfo.appSettings.showLineEndCommentSql;
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentSql;
}
@Override
protected @Nullable String refElementDoc(@NotNull LineInfo lineInfo,
protected @Nullable String refElementDoc(@NotNull LineInfo info,
@NotNull PsiElement ref) {
JBIterable<DbElement> relatedDbElements;
Class<?> clazz;
@@ -55,7 +55,7 @@ public class SqlLangDoc extends BaseLangDoc {
}
for (@NotNull DbElement dbElement : relatedDbElements) {
@Nullable String refDoc = dbElement.getComment();
if (refDoc != null && !DocSkip.skipDoc(lineInfo, refDoc)) {
if (refDoc != null && !DocSkip.skipDoc(info, refDoc)) {
return refDoc;
}
}

View File

@@ -26,10 +26,10 @@ public abstract class BaseLangDoc extends EditorLinePainter {
public abstract @Nullable Class<? extends PsiElement> getRefClass();
public abstract boolean show(@NotNull LineInfo lineInfo);
public abstract boolean show(@NotNull LineInfo info);
@Nullable
public <T extends SettingsInfo> String treeDoc(T settingsInfo, ProjectViewNode<?> node, Project project) {
public <T extends SettingsInfo> String treeDoc(T info, ProjectViewNode<?> node, Project project) {
return null;
}
@@ -40,21 +40,21 @@ public abstract class BaseLangDoc extends EditorLinePainter {
return null;
}
public static @Nullable String langDoc(@NotNull LineInfo lineInfo) {
@Nullable PsiElement element = lineInfo.viewProvider.findElementAt(lineInfo.endOffset);
public static @Nullable String langDoc(@NotNull LineInfo info) {
@Nullable PsiElement element = info.viewProvider.findElementAt(info.endOffset);
if (element == null) {
// file end
element = lineInfo.viewProvider.findElementAt(lineInfo.endOffset - 1);
element = info.viewProvider.findElementAt(info.endOffset - 1);
if (element == null) {
return null;
}
}
@NotNull Language language = PsiElementTo.language(element);
BaseLangDoc lineEnd = LANG_DOC_MAP.get(language.getID());
if (lineEnd != null && lineEnd.show(lineInfo)) {
return lineEnd.findRefDoc(lineInfo, element);
} else if (language == JsonLanguage.INSTANCE && JsonLangDoc.INSTANCE.show(lineInfo)) {
return JsonLangDoc.INSTANCE.findRefDoc(lineInfo, element);
if (lineEnd != null && lineEnd.show(info)) {
return lineEnd.findRefDoc(info, element);
} else if (language == JsonLanguage.INSTANCE && JsonLangDoc.INSTANCE.show(info)) {
return JsonLangDoc.INSTANCE.findRefDoc(info, element);
}
return null;
}
@@ -63,7 +63,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
* Override like JSON
*/
@Nullable
public String findRefDoc(@NotNull LineInfo lineInfo, @NotNull PsiElement element) {
public String findRefDoc(@NotNull LineInfo info, @NotNull PsiElement element) {
@Nullable Class<? extends PsiElement> refClass = getRefClass();
if (refClass == null) {
return null;
@@ -71,9 +71,9 @@ public abstract class BaseLangDoc extends EditorLinePainter {
@Nullable String doc = null;
@Nullable String text = null;
@Nullable PsiElement refElement = element;
while ((refElement = Prev.prevRefChild(lineInfo, refElement, refClass)) != null) {
while ((refElement = Prev.prevRefChild(info, refElement, refClass)) != null) {
PsiElement parent = refElement.getParent();
@Nullable String filterDoc = refElementDoc(lineInfo, parent);
@Nullable String filterDoc = refElementDoc(info, parent);
if (filterDoc != null) {
doc = filterDoc;
text = refElement.getText();
@@ -85,14 +85,14 @@ public abstract class BaseLangDoc extends EditorLinePainter {
return null;
}
// before doc
refElement = Prev.prevRefChild(lineInfo, refElement, refClass);
refElement = Prev.prevRefChild(info, refElement, refClass);
if (refElement == null) {
return doc;
}
PsiElement parent = refElement.getParent();
@Nullable String before = refElementDoc(lineInfo, parent);
@Nullable String before = refElementDoc(info, parent);
if (before != null) {
doc = mergeDoc(refElement.getText(), text, lineInfo.appSettings.getToSet, before, doc);
doc = mergeDoc(refElement.getText(), text, info.appSettings.getToSet, before, doc);
}
return doc;
}
@@ -123,10 +123,10 @@ public abstract class BaseLangDoc extends EditorLinePainter {
* Override like SQL
*/
@Nullable
protected String refElementDoc(@NotNull LineInfo lineInfo,
protected String refElementDoc(@NotNull LineInfo info,
@NotNull PsiElement refElement) {
@Nullable String refDoc = refDoc(lineInfo, refElement);
if (refDoc != null && !DocSkip.skipDoc(lineInfo, refDoc)) {
@Nullable String refDoc = refDoc(info, refElement);
if (refDoc != null && !DocSkip.skipDoc(info, refDoc)) {
return refDoc;
}
return null;
@@ -136,7 +136,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
* Override like Java/Json
*/
@Nullable
protected String refDoc(@NotNull LineInfo lineInfo, @NotNull PsiElement ref) {
protected String refDoc(@NotNull LineInfo info, @NotNull PsiElement ref) {
// kotlin ref.getReference() == null but ref.getReferences().length == 2
@NotNull PsiReference[] references = ref.getReferences();
if (references.length < 1) {
@@ -154,7 +154,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
if (resolve == null) {
return null;
}
@Nullable String resolveDoc = resolveDoc(lineInfo, resolve);
@Nullable String resolveDoc = resolveDoc(info, resolve);
if (resolveDoc != null) {
return resolveDoc;
}
@@ -162,7 +162,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
return null;
}
public static @Nullable <T extends SettingsInfo> String resolveDoc(@NotNull T settingsInfo,
public static @Nullable <T extends SettingsInfo> String resolveDoc(@NotNull T info,
@NotNull PsiElement psiElement) {
// support like java <-> kotlin
@NotNull Language language = PsiElementTo.language(psiElement);
@@ -170,20 +170,20 @@ public abstract class BaseLangDoc extends EditorLinePainter {
if (lineEnd == null) {
return null;
}
return lineEnd.resolveDocPrint(settingsInfo, psiElement);
return lineEnd.resolveDocPrint(info, psiElement);
}
/**
* Override like Java/Kotlin/Python
*/
@Nullable
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T lineInfo, @NotNull PsiElement resolve) {
@Nullable String s = resolveDocRaw(lineInfo, resolve);
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
@Nullable String s = resolveDocRaw(info, resolve);
if (s == null) {
return null;
}
@NotNull String cutDoc = DocFilter.cutDoc(s, lineInfo, true);
@NotNull String filterDoc = DocFilter.filterDoc(cutDoc, lineInfo.globalSettings, lineInfo.projectSettings);
@NotNull String cutDoc = DocFilter.cutDoc(s, info, true);
@NotNull String filterDoc = DocFilter.filterDoc(cutDoc, info.globalSettings, info.projectSettings);
if (filterDoc.trim().isEmpty()) {
return null;
}
@@ -194,16 +194,16 @@ public abstract class BaseLangDoc extends EditorLinePainter {
* Override like JS/Go
*/
@Nullable
protected <T extends SettingsInfo> String resolveDocRaw(@NotNull T lineInfo, @NotNull PsiElement resolve) {
protected <T extends SettingsInfo> String resolveDocRaw(@NotNull T info, @NotNull PsiElement resolve) {
@Nullable FileViewProvider viewProvider = PsiElementTo.viewProvider(resolve);
if (viewProvider == null) {
return null;
}
@Nullable String doc = ResolveDoc.fromLineEnd(lineInfo, resolve, viewProvider);
@Nullable String doc = ResolveDoc.fromLineEnd(info, resolve, viewProvider);
if (doc != null) {
return doc;
}
return ResolveDoc.fromLineUp(lineInfo, resolve, viewProvider, keywords());
return ResolveDoc.fromLineUp(info, resolve, viewProvider, keywords());
}
@NotNull

View File

@@ -8,28 +8,28 @@ import org.jetbrains.annotations.Nullable;
public abstract class BaseTagLangDoc<DocElement> extends BaseLangDoc {
@Override
public @Nullable <T extends SettingsInfo> String resolveDocPrint(@NotNull T settingsInfo,
public @Nullable <T extends SettingsInfo> String resolveDocPrint(@NotNull T info,
@NotNull PsiElement resolve) {
@Nullable DocElement docElement = toDocElement(settingsInfo, resolve);
if (docElement == null && parseBaseComment(settingsInfo)) {
return super.resolveDocPrint(settingsInfo, resolve);
@Nullable DocElement docElement = toDocElement(info, resolve);
if (docElement == null && parseBaseComment(info)) {
return super.resolveDocPrint(info, resolve);
}
return docElementToStr(settingsInfo, docElement);
return docElementToStr(info, docElement);
}
@Nullable
public <T extends SettingsInfo> String docElementToStr(@NotNull T lineInfo, @Nullable DocElement docElement) {
public <T extends SettingsInfo> String docElementToStr(@NotNull T info, @Nullable DocElement docElement) {
if (docElement == null) {
return null;
}
// desc
@NotNull String descDoc = descDoc(lineInfo, docElement).trim();
@NotNull String desc = DocFilter.filterDoc(descDoc, lineInfo.globalSettings, lineInfo.projectSettings);
@NotNull String descDoc = descDoc(info, docElement).trim();
@NotNull String desc = DocFilter.filterDoc(descDoc, info.globalSettings, info.projectSettings);
// tag
@NotNull StringBuilder tagStrBuilder = new StringBuilder();
@NotNull String[] names = lineInfo.tagNames();
@NotNull String[] names = info.tagNames();
for (@NotNull String name : names) {
appendTag(lineInfo, tagStrBuilder, docElement, name);
appendTag(info, tagStrBuilder, docElement, name);
}
if (!desc.isEmpty()) {
if (tagStrBuilder.length() > 0) {
@@ -44,19 +44,19 @@ public abstract class BaseTagLangDoc<DocElement> extends BaseLangDoc {
return text;
}
protected abstract <T extends SettingsInfo> boolean parseBaseComment(T settingsInfo);
protected abstract <T extends SettingsInfo> boolean parseBaseComment(T info);
@Nullable
protected abstract <T extends SettingsInfo> DocElement toDocElement(@NotNull T settingsInfo,
protected abstract <T extends SettingsInfo> DocElement toDocElement(@NotNull T info,
@NotNull PsiElement resolve);
/**
* cut / * # not filter text
*/
@NotNull
protected abstract <T extends SettingsInfo> String descDoc(@NotNull T lineInfo, @NotNull DocElement docElement);
protected abstract <T extends SettingsInfo> String descDoc(@NotNull T info, @NotNull DocElement docElement);
protected abstract <T extends SettingsInfo> void appendTag(@NotNull T lineInfo,
protected abstract <T extends SettingsInfo> void appendTag(@NotNull T info,
@NotNull StringBuilder tagStrBuilder,
@NotNull DocElement docElement, @NotNull String name);
}

View File

@@ -10,35 +10,35 @@ public class DocSkip {
private DocSkip() {}
public static <T extends SettingsInfo> boolean skipSign(@NotNull T settingsInfo, String text) {
return skipText(settingsInfo, text,
settingsInfo.globalSettings.lineInclude, settingsInfo.globalSettings.lineExclude,
settingsInfo.projectSettings.lineInclude, settingsInfo.projectSettings.lineExclude);
public static <T extends SettingsInfo> boolean skipSign(@NotNull T info, String text) {
return skipText(info, text,
info.globalSettings.lineInclude, info.globalSettings.lineExclude,
info.projectSettings.lineInclude, info.projectSettings.lineExclude);
}
private static final Pattern NOT_ASCII_PATTERN = Pattern.compile("[^\u0000-\u007f]");
public static <T extends SettingsInfo> boolean skipDoc(@NotNull T settingsInfo, @NotNull String text) {
if (settingsInfo.appSettings.skipAscii && !NOT_ASCII_PATTERN.matcher(text).find()) {
public static <T extends SettingsInfo> boolean skipDoc(@NotNull T info, @NotNull String text) {
if (info.appSettings.skipAscii && !NOT_ASCII_PATTERN.matcher(text).find()) {
return true;
}
return skipText(settingsInfo, text,
settingsInfo.globalSettings.docInclude, settingsInfo.globalSettings.docExclude,
settingsInfo.projectSettings.docInclude, settingsInfo.projectSettings.docExclude);
return skipText(info, text,
info.globalSettings.docInclude, info.globalSettings.docExclude,
info.projectSettings.docInclude, info.projectSettings.docExclude);
}
static <T extends SettingsInfo> boolean skipText(@NotNull T settingsInfo, @Nullable String text,
static <T extends SettingsInfo> boolean skipText(@NotNull T info, @Nullable String text,
@NotNull Pattern appDocInclude, @NotNull Pattern appDocExclude,
@NotNull Pattern projectDocInclude, @NotNull Pattern projectDocExclude
) {
if (text == null) {
return true;
}
if (settingsInfo.projectSettings.globalFilterEffective
if (info.projectSettings.globalFilterEffective
&& skipText(text, appDocInclude, appDocExclude)) {
return true;
}
if (settingsInfo.projectSettings.projectFilterEffective) {
if (info.projectSettings.projectFilterEffective) {
return skipText(text, projectDocInclude, projectDocExclude);
}
return false;

View File

@@ -16,18 +16,18 @@ public class Prev {
private Prev() {}
@Nullable
public static PsiElement prevRefChild(@NotNull LineInfo lineInfo, @NotNull PsiElement element,
public static PsiElement prevRefChild(@NotNull LineInfo info, @NotNull PsiElement element,
@NotNull Class<? extends PsiElement> refClass) {
@Nullable PsiElement prevParent = refClassParent(element, refClass);
while ((element = PsiTreeUtil.prevVisibleLeaf(element)) != null) {
if (element.getTextRange().getEndOffset() < lineInfo.startOffset) {
if (element.getTextRange().getEndOffset() < info.startOffset) {
return null;
}
@Nullable PsiElement parent = refClassParent(element, refClass);
if (parent != null) {
// skip b in a.b.c
if (prevParent != null
&& prevParent.getTextRange().getEndOffset() < lineInfo.endOffset
&& prevParent.getTextRange().getEndOffset() < info.endOffset
&& PsiTreeUtil.findChildOfType(prevParent, refClass) == parent) {
prevParent = parent;
} else {
@@ -68,7 +68,7 @@ public class Prev {
}
public static @Nullable <T extends SettingsInfo> PsiElement prevCompactElement(
@SuppressWarnings("unused") @NotNull T lineInfo, @NotNull PsiElement resolve, @NotNull Document document) {
@SuppressWarnings("unused") @NotNull T info, @NotNull PsiElement resolve, @NotNull Document document) {
@Nullable PsiElement element = PsiTreeUtil.prevVisibleLeaf(resolve);
if (element == null) {
return null;

View File

@@ -16,7 +16,7 @@ public class ResolveDoc {
private ResolveDoc() {}
@Nullable
public static <T extends SettingsInfo> String fromLineEnd(@SuppressWarnings("unused") @NotNull T lineInfo,
public static <T extends SettingsInfo> String fromLineEnd(@SuppressWarnings("unused") @NotNull T info,
@NotNull PsiElement resolve,
@NotNull FileViewProvider resolveViewProvider) {
@Nullable Document document = resolveViewProvider.getDocument();
@@ -50,7 +50,7 @@ public class ResolveDoc {
}
@Nullable
public static <T extends SettingsInfo> String fromLineUp(@NotNull T lineInfo,
public static <T extends SettingsInfo> String fromLineUp(@NotNull T info,
@NotNull PsiElement resolve,
@NotNull FileViewProvider resolveViewProvider,
@NotNull List<String> keywords) {
@@ -60,13 +60,13 @@ public class ResolveDoc {
}
@Nullable PsiElement psiElement = PsiTreeUtil.getChildOfType(resolve, PsiComment.class);
if (psiElement == null) {
psiElement = Prev.prevCompactElement(lineInfo, resolve, document);
psiElement = Prev.prevCompactElement(info, resolve, document);
}
if (!keywords.isEmpty()) {
while (psiElement != null) {
String text = psiElement.getText();
if (keywords.contains(text)) {
psiElement = Prev.prevCompactElement(lineInfo, psiElement, document);
psiElement = Prev.prevCompactElement(info, psiElement, document);
} else {
break;
}
@@ -77,7 +77,7 @@ public class ResolveDoc {
while (isComment) {
String text = psiElement.getText();
int thisStartOffset = psiElement.getTextRange().getStartOffset();
psiElement = Prev.prevCompactElement(lineInfo, psiElement, document);
psiElement = Prev.prevCompactElement(info, psiElement, document);
isComment = psiElement instanceof PsiComment;
if (!isComment && psiElement != null) {
int prevEndOffset = psiElement.getTextRange().getEndOffset();

View File

@@ -15,9 +15,9 @@ public class RelFileDoc {
private RelFileDoc() {}
@Nullable
public static String relFileDoc(ProjectViewNode<?> node, @NotNull SettingsInfo settingsInfo) {
@NotNull ProjectSettingsState projectSettings = settingsInfo.projectSettings;
@NotNull GlobalSettingsState globalSettings = settingsInfo.globalSettings;
public static String relFileDoc(ProjectViewNode<?> node, @NotNull SettingsInfo info) {
@NotNull ProjectSettingsState projectSettings = info.projectSettings;
@NotNull GlobalSettingsState globalSettings = info.globalSettings;
if (projectSettings.projectFilterEffective) {
@Nullable String doc = relDoc(node, projectSettings);
if (StringUtils.isNotBlank(doc)) {

View File

@@ -18,7 +18,7 @@ public class CsLineEnd extends BaseLangDoc {
}
@Override
public boolean show(@NotNull LineInfo lineInfo) {
public boolean show(@NotNull LineInfo info) {
return true;
}