aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin/java.vim
diff options
context:
space:
mode:
authorBarrett Ruth <br@barrettruth.com>2026-07-31 23:52:07 -0500
committerBarrett Ruth <br@barrettruth.com>2026-08-03 15:22:25 -0500
commit886a270e7f4162933e180d3d96c3ef7ea162d4a0 (patch)
tree39dc23adf0aae24020a5e2c6da11ab6d772611e0 /runtime/ftplugin/java.vim
parent8787b8b9b6a3c745905cd11ba93205e8da9697ed (diff)
downloadrneovim-886a270e7f4162933e180d3d96c3ef7ea162d4a0.tar.gz
rneovim-886a270e7f4162933e180d3d96c3ef7ea162d4a0.tar.bz2
rneovim-886a270e7f4162933e180d3d96c3ef7ea162d4a0.zip
refactor(zip)!: address entries with zip:// paths
Problem: `zipfile://{archive}::{entry}` is ambiguous: `::` is legal in both an archive path and an entry path, so the separator cannot be identified. Splitting at the last `::` reads archives correctly but breaks entries that contain it, and the plugin then emits buffer names it cannot read back. Solution: Address entries as `zip://{archive}/{entry}`, joining the two paths. Resolve the split by walking components: the first one that is a regular file is the archive, because a regular file cannot have children on disk. Entry paths may then contain any character, and no escaping is needed. zipPlugin.vim keeps its own scheme, so the Java ftplugin emits whichever form matches the active plugin until the legacy package is removed.
Diffstat (limited to 'runtime/ftplugin/java.vim')
-rw-r--r--runtime/ftplugin/java.vim13
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim
index 00d0532dd6..509f5d146b 100644
--- a/runtime/ftplugin/java.vim
+++ b/runtime/ftplugin/java.vim
@@ -80,8 +80,11 @@ if exists("g:ftplugin_java_source_path") &&
function! JavaFileTypeZipFile() abort
let l:member = substitute(v:fname, '\.', '/', 'g') . '.java'
- return 'zipfile://' . get(s:zip_files, bufnr('%'), s:zip_files[0]) .
- \ '::' . l:member
+ let l:archive = get(s:zip_files, bufnr('%'), s:zip_files[0])
+ " The builtin plugin joins the paths; zipPlugin.vim separates them with "::".
+ return exists('#nvim.zip')
+ \ ? 'zip://' . l:archive . '/' . l:member
+ \ : 'zipfile://' . l:archive . '::' . l:member
endfunction
" E120 for "inex=s:JavaFileTypeZipFile()" before v8.2.3900.
@@ -391,7 +394,11 @@ if exists("s:zip_func_upgradable")
def! s:JavaFileTypeZipFile(): string
const member: string = substitute(v:fname, '\.', '/', 'g') .. '.java'
- return 'zipfile://' .. get(zip_files, bufnr('%'), zip_files[0]) .. '::' .. member
+ const archive: string = get(zip_files, bufnr('%'), zip_files[0])
+ # The builtin plugin joins the paths; zipPlugin.vim separates them with "::".
+ return exists('#nvim.zip')
+ ? 'zip://' .. archive .. '/' .. member
+ : 'zipfile://' .. archive .. '::' .. member
enddef
setlocal includeexpr=s:JavaFileTypeZipFile()