~dannyfreeman/jarchive-dev

1

[PATCH] Handle jar files whose names end in ".zip".

Details
Message ID
<CAPNkkpmGKP31d5XX_NuXBt600NJ9FnDAC1BkJoJA14=hocKHqQ@mail.gmail.com>
DKIM signature
missing
Download raw message
Handling files whose names end in ".zip" allows LSP servers to refer to source
code in the JDK's src.zip file.

Additionally, handle files in a jar or zip that do not have names containing a
period character.

Finally, update Java language server compatibility info in README.md.
---
 README.md   | 6 ++++--
 jarchive.el | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index d3c4c70..9a1005d 100644
--- a/README.md
+++ b/README.md
@@ -73,9 +73,11 @@ so that the transient lsp server that is started
when opening the file is closed

 ## Language server compatibility

-I personally only test this with [clojure-lsp](https://clojure-lsp.io/).
+I personally only test Jarchive with [clojure-lsp](https://clojure-lsp.io/).
+
+Users report that Jarchive works well with the Java LSP server
+[java-language-server](https://github.com/georgewfraser/java-language-server).

-I have heard from other users that it also works with some
unspecified java language server.
 I do know that it does not work with `JDTLS` at them moment, which
requires all clients to implement custom language server extensions
and a complicated non-standard URI scheme to open files in JARs.

 Any language server that provides jar: scheme URIs should be picked
up by this package.
diff --git a/jarchive.el b/jarchive.el
index c614f68..4089e73 100644
--- a/jarchive.el
+++ b/jarchive.el
@@ -39,14 +39,14 @@
    line-start
    (or "jar:file://" "zipfile://")
    ;; match group 1, the jar file location
-   (group "/" (* not-newline) ".jar")
+   (group "/" (* not-newline) (or ".jar" ".zip"))
    ;; Delimiter between the jar and the file inside the jar
    (or "!" "::")
    ;; match the leading directory delimiter /,
-   ;; archvie mode expects none so it's outside match group 2
+   ;; archive mode expects none so it's outside match group 2
    (zero-or-one "/")
    ;; match group 2, the file within the archive
-   (group (* not-newline) "." (+ alphanumeric))
+   (group (* not-newline))
    line-end)
   "A regex for matching paths to a jar file and a file path into the jar file.
 Delimited by `!' for jar: schemes. Delimited by `::' for zipfile: schemes.")
-- 
2.25.1
Details
Message ID
<87tu0nzpgi.fsf@dfreeman.email>
In-Reply-To
<CAPNkkpmGKP31d5XX_NuXBt600NJ9FnDAC1BkJoJA14=hocKHqQ@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Robert Brown <robert.brown@gmail.com> writes:

> Handling files whose names end in ".zip" allows LSP servers to refer to source
> code in the JDK's src.zip file.
>
> Additionally, handle files in a jar or zip that do not have names containing a
> period character.
>
> Finally, update Java language server compatibility info in README.md.
> ---
>  README.md   | 6 ++++--
>  jarchive.el | 6 +++---
>  2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/README.md b/README.md
> index d3c4c70..9a1005d 100644
> --- a/README.md
> +++ b/README.md
> @@ -73,9 +73,11 @@ so that the transient lsp server that is started
> when opening the file is closed
>
>  ## Language server compatibility
>
> -I personally only test this with [clojure-lsp](https://clojure-lsp.io/).
> +I personally only test Jarchive with [clojure-lsp](https://clojure-lsp.io/).
> +
> +Users report that Jarchive works well with the Java LSP server
> +[java-language-server](https://github.com/georgewfraser/java-language-server).
>
> -I have heard from other users that it also works with some
> unspecified java language server.
>  I do know that it does not work with `JDTLS` at them moment, which
> requires all clients to implement custom language server extensions
> and a complicated non-standard URI scheme to open files in JARs.
>
>  Any language server that provides jar: scheme URIs should be picked
> up by this package.
> diff --git a/jarchive.el b/jarchive.el
> index c614f68..4089e73 100644
> --- a/jarchive.el
> +++ b/jarchive.el
> @@ -39,14 +39,14 @@
>     line-start
>     (or "jar:file://" "zipfile://")
>     ;; match group 1, the jar file location
> -   (group "/" (* not-newline) ".jar")
> +   (group "/" (* not-newline) (or ".jar" ".zip"))
>     ;; Delimiter between the jar and the file inside the jar
>     (or "!" "::")
>     ;; match the leading directory delimiter /,
> -   ;; archvie mode expects none so it's outside match group 2
> +   ;; archive mode expects none so it's outside match group 2
>     (zero-or-one "/")
>     ;; match group 2, the file within the archive
> -   (group (* not-newline) "." (+ alphanumeric))
> +   (group (* not-newline))
>     line-end)
>    "A regex for matching paths to a jar file and a file path into the jar file.
>  Delimited by `!' for jar: schemes. Delimited by `::' for zipfile: schemes.")

Hello!

Thank you very much for submitting your patch.
I pulled them down and tested them with my setup and they seem to be
working great. I have applied the patch and pushed a new version to this
repository. It should be picked up by ELPA sometime today or tomorrow.

Here is the latest changelog entry:
https://git.sr.ht/~dannyfreeman/jarchive/tree/main/item/CHANGELOG.md#2023-01-18-0100-release-notes

-- 
Danny Freeman
Reply to thread Export thread (mbox)