Skip to content

Commit

Permalink
fix: ignore non-local files in LSPDocumentationProvider#handleExterna…
Browse files Browse the repository at this point in the history
…lLink

Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon authored and angelozerr committed Nov 6, 2023
1 parent cf3205e commit 24dd5ea
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.util.io.URLUtil;
import com.redhat.devtools.intellij.lsp4ij.LSPIJUtils;
import com.redhat.devtools.intellij.lsp4ij.operations.completion.LSPCompletionProposal;
import com.vladsch.flexmark.html.HtmlRenderer;
Expand Down Expand Up @@ -146,6 +147,10 @@ public boolean handleExternal(PsiElement element, PsiElement originalElement) {

@Override
public boolean handleExternalLink(PsiManager psiManager, String link, PsiElement context) {
//Ignore non-local uri (http(s), mailto, ftp...)
if (URLUtil.URL_PATTERN.matcher(link).matches()) {
return false;
}
VirtualFile file = LSPIJUtils.findResourceFor(link);
if (file != null) {
FileEditorManager.getInstance(psiManager.getProject()).openFile(file, true, true);
Expand Down

0 comments on commit 24dd5ea

Please sign in to comment.