fix(RustLangDoc): support rust package comment //! fixed #55

This commit is contained in:
林万程
2024-07-28 17:20:00 +08:00
parent 3ac2b8b680
commit e60ad5722e
2 changed files with 13 additions and 1 deletions

View File

@@ -2,8 +2,10 @@ package io.github.linwancen.plugin.show.lang;
import com.intellij.psi.PsiElement;
import io.github.linwancen.plugin.show.bean.LineInfo;
import io.github.linwancen.plugin.show.bean.SettingsInfo;
import io.github.linwancen.plugin.show.lang.base.BaseLangDoc;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.rust.lang.RsLanguage;
import org.rust.lang.core.psi.RsMethodCall;
import org.rust.lang.core.psi.RsPath;
@@ -25,4 +27,14 @@ public class RustLangDoc extends BaseLangDoc {
public boolean show(@NotNull LineInfo info) {
return info.appSettings.showLineEndCommentRustBase;
}
@Nullable
@Override
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
String s = super.resolveDocPrint(info, resolve);
if (s != null && s.startsWith("!")) {
return s.substring(1);
}
return s;
}
}

View File

@@ -1,4 +1,4 @@
// file tree doc is any where not doc comment
//! file tree doc is any where not doc comment
fn main() {
my_fun()