Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mopemope committed May 26, 2019
2 parents 5ea8a53 + 64518b5 commit 24813cf
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 28 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ Meghanada updates any information when saving and compile the java file.

If the completion candidate and others are incorrect, please fix the compile error.

### Telemetry

If you can help improve server performance etc. please enable Telemetry.

If you allow Meghanada to submit performance data, the Telemetry system will collect and submit various measurement data from the user environment, such as Meghanada's performance.

## Installation

### Elisp
Expand All @@ -73,6 +79,8 @@ Install meghanada from melpa.
(lambda ()
;; meghanada-mode on
(meghanada-mode t)
;; enable telemetry
(meghanada-telemetry-enable t)
(flycheck-mode +1)
(setq c-basic-offset 2)
;; use code format
Expand Down
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Version 1.2.0 (2019-05-26)

* collect telemetry data of meghanada-server (default disabled).
* fix constructor completion format.
* fix array completion.
* fix some bugs and improve stability.

# Version 1.1.2 (2019-05-09)

* fix NoClassDefFoundError when run junit.
Expand Down
2 changes: 1 addition & 1 deletion company-meghanada.el
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
(cons :async
#'(lambda (callback)
(meghanada-autocomplete-prefix-async
(format "\"%s\"" prefix)
prefix
(list #'company-meghanada--autocomplete-callback callback)))))))

(defun meghanada--search-method-caller ()
Expand Down
69 changes: 42 additions & 27 deletions meghanada.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; Author: Yutaka Matsubara ([email protected])
;; Homepage: https://github.com/mopemope/meghanada-emacs
;; Keywords: languages java
;; Package-Version: 1.1.2
;; Package-Version: 1.2.0
;; Package-Requires: ((emacs "24.3") (yasnippet "0.6.1") (company "0.9.0") (flycheck "0.23"))

;; This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -48,7 +48,7 @@
;; Const
;;

(defconst meghanada-version "1.1.2")
(defconst meghanada-version "1.2.0")
(defconst meghanada-setup-version "0.0.2")
(defconst meghanada--eot "\n;;EOT\n")
(defconst meghanada--junit-buf-name "*meghanada-junit*")
Expand Down Expand Up @@ -244,7 +244,7 @@ Example. (setq meghanada-jvm-option \"-Dhttp.proxyHost=test.proxy.com -Dhttp.pro
:type 'string)

(defcustom meghanada-full-text-search-enable nil
"If true, enable full text search and meghanada-search-everywhere."
"If true, Enable full text search and meghanada-search-everywhere."
:group 'meghanada
:type 'boolean)

Expand All @@ -254,20 +254,33 @@ Example. (setq meghanada-jvm-option \"-Dhttp.proxyHost=test.proxy.com -Dhttp.pro
:type 'string)

(defcustom meghanada-class-completion-matcher "prefix"
"Select class completion matcher. You can choose from prefix, contains, fuzzy, came-case. default is prefix."
"Select class completion matcher. You can choose from prefix, contains, fuzzy, came-case. default is prefix."
:group 'meghanada
:type 'string)

(defcustom meghanada-mode-after-test-hook '()
"Hook that is called after a JUnit test execution is done."
:group 'meghanada)

(defcustom meghanada-telemetry-enable nil
"If true, Enables telemetry and allows you to collect and submit performance data."
:group 'meghanada
:type 'boolean)

;;
;; utility
;;

(defun meghanada--what-line ()
"TODO: FIX DOC ."
(format-mode-line "%l"))
"Return the current buffer line number and narrowed line number of point."
(let ((start (point-min))
(n (line-number-at-pos)))
(if (= start 1)
n
(save-excursion
(save-restriction
(widen)
(+ n (line-number-at-pos start) -1) n)))))

(defun meghanada--real-current-column ()
"like `current-column', but skip invisible characters in pretty-symbol-mode."
Expand Down Expand Up @@ -517,6 +530,8 @@ function."
(push (format "-Dmeghanada.class.completion.matcher=%s" meghanada-class-completion-matcher) options))
(when meghanada-jvm-option
(push meghanada-jvm-option options))
(when meghanada-telemetry-enable
(push "-Dmeghanada.telemetry.enable=true" options))
(push "-Djava.net.preferIPv4Stack=true" options)
(mapconcat 'identity options " ")))

Expand Down Expand Up @@ -1059,21 +1074,21 @@ e.g. java.lang.annotation)."
(defun meghanada-add-import-async (imp callback buf)
"TODO: FIX DOC IMP CALLBACK BUF."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "ai" (list callback buf) (buffer-file-name) imp)
(meghanada--send-request "ai" (list callback buf) (format "\"%s\"" (buffer-file-name)) imp)
(message "client connection not established")))

(defun meghanada-import-all-async (callback buf optimize)
"TODO: FIX DOC CALLBACK BUF OPTIMIZE."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "ia" (list callback buf optimize) (buffer-file-name))
(meghanada--send-request "ia" (list callback buf optimize) (format "\"%s\"" (buffer-file-name)))
(message "client connection not established")))

(defun meghanada-import-at-point-async (callback buf optimize)
"TODO: FIX DOC CALLBACK BUF OPTIMIZE."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "ip"
(list callback buf optimize)
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line)
(meghanada--what-column)
(format "\"%s\"" (meghanada--what-symbol)))
Expand All @@ -1085,7 +1100,7 @@ e.g. java.lang.annotation)."
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(let ((output (meghanada--send-request-sync
"oi"
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--write-tmpfile))))
(when output
(let ((patchbuf (get-buffer-create "*meghanada-fmt patch*"))
Expand Down Expand Up @@ -1123,18 +1138,18 @@ e.g. java.lang.annotation)."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "ap"
callback
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line)
(meghanada--what-column)
prefix)
(format "\"%s\"" prefix))
(message "client connection not established")))

(defun meghanada-autocomplete-resolve-async (type item desc callback)
"TODO: FIX DOC TYPE ITEM DESC CALLBACK."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "cr"
callback
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line)
(meghanada--what-column)
(format "\"%s\"" type)
Expand Down Expand Up @@ -1164,7 +1179,7 @@ e.g. java.lang.annotation)."
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(meghanada--send-request "lv"
#'meghanada--local-val-callback
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line))
(message "client connection not established")))

Expand All @@ -1177,7 +1192,7 @@ e.g. java.lang.annotation)."
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "di"
callback
(buffer-file-name))
(format "\"%s\"" (buffer-file-name)))
(message "client connection not established")))

(defun meghanada-diagnostic-string-async (callback)
Expand Down Expand Up @@ -1236,7 +1251,7 @@ e.g. java.lang.annotation)."
(interactive)
(when (meghanada-alive-p)
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(let ((buf (buffer-file-name)))
(let ((buf (format "\"%s\"" (buffer-file-name))))
(message "compiling ... ")
(meghanada--kill-buf "*compilation*")
(pop-to-buffer "*compilation*")
Expand All @@ -1248,7 +1263,7 @@ e.g. java.lang.annotation)."
(interactive)
(when (meghanada-alive-p)
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(let ((buf (buffer-file-name)))
(let ((buf (format "\"%s\"" (buffer-file-name))))
(message "compiling ... ")
(meghanada--kill-buf "*compilation*")
(pop-to-buffer "*compilation*")
Expand Down Expand Up @@ -1278,7 +1293,7 @@ e.g. java.lang.annotation)."
"TODO: FIX DOC CALLBACK."
(interactive)
(if (and meghanada--server-process (process-live-p meghanada--server-process))
(meghanada--send-request "st" #'meghanada--switch-testcase-callback (buffer-file-name))
(meghanada--send-request "st" #'meghanada--switch-testcase-callback (format "\"%s\"" (buffer-file-name)))
(message "client connection not established")))


Expand Down Expand Up @@ -1310,8 +1325,8 @@ e.g. java.lang.annotation)."
(setq meghanada--task-buffer meghanada--junit-buf-name)
(pop-to-buffer meghanada--junit-buf-name)
(if debug
(meghanada--send-request-process "dj" meghanada--task-client-process #'meghanada--junit-callback file test)
(meghanada--send-request-process "rj" meghanada--task-client-process #'meghanada--junit-callback file test)))
(meghanada--send-request-process "dj" meghanada--task-client-process #'meghanada--junit-callback (format "\"%s\"" file) test)
(meghanada--send-request-process "rj" meghanada--task-client-process #'meghanada--junit-callback (format "\"%s\"" file) test)))
(message "client connection not established")))

(defun meghanada-run-junit-class ()
Expand Down Expand Up @@ -1389,7 +1404,7 @@ e.g. java.lang.annotation)."
(setq meghanada--task-client-process (meghanada--start-task-client-process)))

(if (and meghanada--task-client-process (process-live-p meghanada--task-client-process))
(let ((file (buffer-file-name)))
(let ((file (format "\"%s\"" (buffer-file-name))))
(meghanada--kill-buf meghanada--task-buf-name)
(meghanada--kill-buf meghanada--junit-buf-name)
(setq meghanada--task-buffer meghanada--task-buf-name)
Expand All @@ -1404,7 +1419,7 @@ e.g. java.lang.annotation)."
(setq meghanada--task-client-process (meghanada--start-task-client-process)))

(if (and meghanada--task-client-process (process-live-p meghanada--task-client-process))
(let ((file (buffer-file-name)))
(let ((file (format "\"%s\"" (buffer-file-name))))
(meghanada--kill-buf meghanada--task-buf-name)
(meghanada--kill-buf meghanada--junit-buf-name)
(setq meghanada--task-buffer meghanada--task-buf-name)
Expand Down Expand Up @@ -1440,7 +1455,7 @@ e.g. java.lang.annotation)."
(let ((sym (meghanada--what-symbol)))
(when sym
(meghanada--send-request "jd" #'meghanada--jump-callback
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line)
(meghanada--what-column)
(format "\"%s\"" sym))))
Expand All @@ -1460,7 +1475,7 @@ e.g. java.lang.annotation)."
(let ((sym (completing-read "Symbol: " (meghanada--list-symbols) nil nil)))
(when sym
(meghanada--send-request "js" #'meghanada--jump-callback
(buffer-file-name)
(format "\"%s\"" (buffer-file-name))
(meghanada--what-line)
(meghanada--what-column)
(format "\"%s\"" sym))))
Expand Down Expand Up @@ -1588,7 +1603,7 @@ e.g. java.lang.annotation)."
(progn
(funcall meghanada-reference-prepare)
(meghanada--send-request "re" meghanada-reference-callback
buf
(format "\"%s\"" buf)
line
col
(format "\"%s\"" sym)))))
Expand Down Expand Up @@ -1651,7 +1666,7 @@ e.g. java.lang.annotation)."
(progn
(funcall meghanada-typeinfo-prepare)
(meghanada--send-request "ti" meghanada-typeinfo-callback
buf
(format "\"%s\"" buf)
line
col
(format "\"%s\"" sym))))
Expand Down Expand Up @@ -1859,7 +1874,7 @@ e.g. java.lang.annotation)."
"Change project root."
(when (meghanada-alive-p)
(if (and meghanada--client-process (process-live-p meghanada--client-process))
(meghanada--send-request "pc" #'identity (buffer-file-name))
(meghanada--send-request "pc" #'identity (format "\"%s\"" (buffer-file-name)))
(message "client connection not established"))))

;;;###autoload
Expand Down

0 comments on commit 24813cf

Please sign in to comment.