From 886a270e7f4162933e180d3d96c3ef7ea162d4a0 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 31 Jul 2026 23:52:07 -0500 Subject: 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. --- runtime/ftplugin/java.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime/ftplugin/java.vim') 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() -- cgit