22
33; ; Version: 1.0
44; ; Package-Requires: ((emacs "25.1") (lsp-mode "3.0") (s "1.2.0"))
5- ; ; Keywords: java
5+ ; ; Keywords: java tools lsp
66; ; URL: https://github.com/tigersoldier/lsp-javacomp
77
88; ; This program is free software: you can redistribute it and/or modify
@@ -52,6 +52,40 @@ Requires to be ended with a slash."
5252 :type '(set string)
5353 :group 'lsp-javacomp )
5454
55+ (defcustom lsp-javacomp-server-log-level nil
56+ " Server log level.
57+ This option sets the value of the logLevel initialization option.
58+ Possible values are \" severe\" , \" warning\" , \" info\" , \" fine\" ,
59+ \" finer\" , \" finest\" . If it's set to nil, the option is not sent
60+ to the server."
61+ :type '(choice
62+ (const nil )
63+ (const " severe" )
64+ (const " warning" )
65+ (const " info" )
66+ (const " fine" )
67+ (const " finer" )
68+ (const " finest" ))
69+ :group 'lsp-javacomp )
70+
71+ (defcustom lsp-javacomp-server-log-path nil
72+ " Server log path.
73+ This option sets the value of the logPath initialization option."
74+ :type '(choice (const nil ) string)
75+ :group 'lsp-javacomp )
76+
77+ (defcustom lsp-javacomp-server-ignore-paths nil
78+ " A list of string paths to be ignored by the server.
79+ This option sets the value of the ignorePaths initialization option."
80+ :type '(repeat string)
81+ :group 'lsp-javacomp )
82+
83+ (defcustom lsp-javacomp-server-type-index-files nil
84+ " A list of string paths of the type index files.
85+ This option sets the value of the typeIndexFiles initialization option."
86+ :type '(repeat string)
87+ :group 'lsp-javacomp )
88+
5589(defconst lsp-javacomp-latest-release-url
5690 " https://api.github.com/repos/tigersoldier/JavaComp/releases/latest"
5791 " URL to retrieve the latest release of JavaComp server." )
@@ -93,6 +127,13 @@ Return a cons of (start . end) for the bound of the prefix."
93127 (setq start (1+ start)))
94128 (cons start end)))
95129
130+ (defun lsp-javacomp--get-init-params (_ )
131+ " Return initialization options."
132+ (list :logPath lsp-javacomp-server-log-path
133+ :logLevel lsp-javacomp-server-log-level
134+ :ignorePths lsp-javacomp-server-ignore-paths
135+ :typeIndexFiles lsp-javacomp-server-type-index-files))
136+
96137;;;### autoload
97138(defun lsp-javacomp-install-server (&optional prompt-exists )
98139 " Download the JavaComp server JAR file if it does not exist.
@@ -107,10 +148,12 @@ file already exists."
107148
108149;;;### autoload
109150(defun lsp-javacomp-update-server ()
151+ " Update JavaComp jar file to the latest version."
110152 (interactive )
111153 (lsp-javacomp--download-server))
112154
113155(defun lsp-javacomp--download-server ()
156+ " Download latest JavaComp jar file."
114157 (message " Getting the latest JavaComp server... " )
115158 (url-retrieve lsp-javacomp-latest-release-url #'lsp-javacomp--latest-release-callback ))
116159
@@ -119,8 +162,7 @@ file already exists."
119162
120163STATS is passed by `url-retrieve' .
121164
122- See https://developer.github.com/v3/repos/releases/#get-the-latest-release
123- "
165+ See https://developer.github.com/v3/repos/releases/#get-the-latest-release"
124166 (search-forward " \n\n " )
125167 (if-let (err (plist-get stats :error ))
126168 (error " Failed to get the latest release of JavaComp server: %s " (car err))
@@ -142,6 +184,7 @@ See https://developer.github.com/v3/repos/releases/#get-the-latest-release
142184 :command-fn #'lsp-javacomp--command
143185 :ignore-regexps '(" ^SLF4J: "
144186 " ^Listening for transport dt_socket at address: " )
187+ :extra-init-params #'lsp-javacomp--get-init-params
145188 :prefix-function #'lsp-javacomp--get-prefix )
146189
147190(provide 'lsp-javacomp )
0 commit comments