22 (:require
33 [clojure.string :as string]
44 [com.github.clojure-lsp.intellij.editor :as editor]
5+ [com.github.ericdallo.clj4intellij.logger :as logger]
56 [com.github.ericdallo.clj4intellij.util :as util])
67 (:import
78 [com.github.clojure_lsp.intellij ClojureLanguage]
1112 [com.intellij.openapi.fileEditor FileEditorManager]
1213 [com.intellij.openapi.project Project]
1314 [com.intellij.openapi.util TextRange]
14- [com.intellij.openapi.vfs VirtualFile]
1515 [com.intellij.psi
1616 PsiElement
1717 PsiElementVisitor
2222
2323(set! *warn-on-reflection* true )
2424
25- VirtualFile
26-
2725(defn ->LSPPsiElement
28- [^String name ^Project project ^PsiFile file
26+ [^String text ^Project project ^PsiFile file
2927 ^Integer start-offset ^Integer end-offset
3028 ^Integer start-line]
3129 (let [psi-manager (PsiManager/getInstance project)
3230 file-editor-manager (FileEditorManager/getInstance project)]
3331 (reify
3432 PsiNameIdentifierOwner
35- (getName [_] (str (editor/filename->project-relative-filename
36- (.getCanonicalPath (.getVirtualFile file))
37- project)
38- " "
39- start-line))
33+ (getName [_]
34+ (str (editor/filename->project-relative-filename
35+ (.getCanonicalPath (.getVirtualFile file))
36+ project)
37+ " "
38+ start-line))
4039 (setName [_ _])
4140 (getNameIdentifier [this] this)
4241 (getIdentifyingElement [this] this)
@@ -55,7 +54,7 @@ VirtualFile
5554 (getTextLength [_] (- end-offset start-offset))
5655 (findElementAt [_ _])
5756 (findReferenceAt [_ _])
58- (textToCharArray [_] (char-array name ))
57+ (textToCharArray [_] (char-array text ))
5958 (getNavigationElement [this] this)
6059 (getOriginalElement [this] this)
6160 (^boolean textMatches [this ^CharSequence text]
@@ -64,7 +63,7 @@ VirtualFile
6463 (.equals (.getText this) (.getText element)))
6564 (^boolean textContains [this ^char c]
6665 (string/includes? (.getText this) (str c)))
67- (getText [_] name )
66+ (getText [_] text )
6867 (^void accept [this ^PsiElementVisitor visitor]
6968 (.visitElement visitor this))
7069 (acceptChildren [_ _])
@@ -91,7 +90,7 @@ VirtualFile
9190 (getUseScope [this] (.getResolveScope (.getContainingFile this)))
9291 (getNode [_])
9392 (isEquivalentTo [this other] (= this other))
94- (toString [_] (str name " :" start-offset " :" end-offset))
93+ (toString [_] (str text " :" start-offset " :" end-offset))
9594 (getContainingFile [_] file)
9695
9796 PsiElementNavigationItem
0 commit comments