Open ahakanbaba opened 1 week ago
I am quite interested in that codepath. If a maintainer could give some guidance, I am more than happy to send a PR.
I have followed the call stack to the following extend
ale#definition#FormatLSPResponse ale#util#ToResource ale#uri#GetURIHandler
And the GetURIHandler looks like the place to add the specialization here.
For example
let s:uri_handlers = {
\ 'jdt': {
\ 'OpenURILink': function('ale#uri#jdt#OpenJDTLink'),
\ }
\}
function! ale#uri#GetURIHandler(uri) abort
for l:scheme in keys(s:uri_handlers)
if a:uri =~# '^'.l:scheme.'://'
return s:uri_handlers[scheme]
endif
endfor
return v:null
endfunction
There is special handling with jdt:// schemes. Maybe that is the place to extend for this new jar:file// scheme.
Information
VIM version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Oct 22 2024 20:01:46) macOS version - arm64
Operating System:
Mac OS Sequoia 15.0.1 (24A348)
What went wrong
I am NOT a Java expert and I am trying to setup Java development in vim. I set up javalsp via Ale.
Completed the setup instructions for java-language-server and put together a very very simple java project. java-tutorial-main.zip Adding the zip file of the java project in the attachment.
Then I try to jump to the definition of a class that is in an external dependency, ALE cannot process the uri in the language-server's response.
For example in the code (
Word.java
from the java-tutorial-main.zip file)When I do
:ALEGoToDefinition
on lombok.Data, the java-language-server request-response looks like thisThe location in the language-server's response looks correct to me.
That is the jar file from the gradle cache. When I extract the tar file and find the lombok/Data.java, the contents looks correct to me.
The LSP defintion.vim handler in Ale cannot handle this response.
The result here looks like this
Then the item_list here looks like this
Then through ALE, vim tries to open this file "jar:file:///Users/hakanbaba/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.34/861d5074b9a04a7f1c1e128584a66b2b815fc3d4/lombok-1.18.34-sources.jar!/lombok/Data.java" [New DIRECTORY]
Instead of finding the file
lombok/Data.java
file inside the given jar archive.Reproducing the bug
./gradlew build idea
at the project root directoryWord.java
.lombok.Data
import.:ALEInfo
The
java-language-server
executable is merely this