Skip to content

Commit 8914cf1

Browse files
committed
Merge branch 'dev'
2 parents 7ea4885 + a2678e4 commit 8914cf1

File tree

5 files changed

+97
-52
lines changed

5 files changed

+97
-52
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ byte-compile.el
33
*.jar
44
meghanada-autoloads.el
55
meghanada-pkg.el
6+
*.txt

README.md

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
## A Better Java Development Environment for Emacs
66

77
`Meghanada` is a new minor-mode (`meghanada-mode`) that aims at improving the editing
8-
experience for the Java. It works by using a combination of an Emacs
8+
experience for Java. It works by using a combination of an Emacs
99
package and [meghanada-server][].
1010

1111
**Features:**
1212

1313
* Easy install
14-
* Auto update server module
14+
* Auto-update server module
1515
* [Gradle][] and [Maven][] and Eclipse project support
1616
* No need build tool's plugin
1717
* Run build tool task
@@ -21,13 +21,13 @@ package and [meghanada-server][].
2121
* Code completion with [company-mode][] (`company-meghanada`)
2222
* Optimize import and sort
2323
* Jump declaration
24-
* Run [Junit][] test (include test runner)
24+
* Run [JUnit][] test (include test runner)
2525
* Diagnostic reporting with [flycheck][] (`flycheck-meghanada`)
2626
* Show symbol's type info with `el-doc`
2727
* Search references
2828
* Full-featured text search
2929

30-
`Meghanada` is tested under `linux`, `Windows` and `macOS`.
30+
`Meghanada` is tested under `Linux`, `Windows` and `macOS`.
3131

3232
(Welcome contributions !)
3333

@@ -48,12 +48,12 @@ Meghanada has been developed Emacs 25.1.1
4848

4949
`meghanada-mode` require [meghanada-server][] and JDK (not JRE).
5050
[meghanada-server][] provides an interface to `meghanada-mode`. It uses a simple protocol
51-
based on S-expressions. This server, written in java, requires the following
51+
based on S-expressions. This server, written in Java, requires the following
5252
packages to be installed on your system:
5353

5454
* JDK 1.8 or later
5555

56-
The Meghanada architecture is almost the same as `ensime`. It is client server model.
56+
The Meghanada architecture is almost the same as `ensime`. It is a client-server model.
5757

5858
Meghanada updates any information when saving and compile the java file.
5959

@@ -94,25 +94,41 @@ If you open a java file and set `meghanada-mode`, a [meghanada-server][] process
9494

9595
### Updating
9696

97-
The server will be automatically updated.To manually update bellows, type
97+
The server will be automatically updated. To manually update bellows, type
9898

9999
```
100100
M-x meghanada-update-server
101101
```
102102

103-
## Auto completion
103+
### Manual Server Installation
104104

105-
Auto completion is supported by `comapany-mode`.
105+
The server will be installed and updated automatically.
106+
107+
If you set it up manually, please follow the instructions below.
108+
109+
#### Download meghanada-setup.jar
110+
111+
A meghanada-setup.jar is a small program that automatically updates the server.
112+
113+
This can be downloaded from:
114+
115+
https://github.com/mopemope/meghanada-server/releases/download/v1.0.13/meghanada-setup-0.0.2.jar
116+
117+
Move the downloaded setup.jar to .emacs.d/meghanada/.
118+
Start Emacs and enable meghanada-mode.
119+
120+
## Autocompletion
121+
122+
Auto-completion is supported by `company-mode`.
106123

107124
Completion matcher is selectable. see type `M-x customize-group RET meghanada`.
108125

109126
## Syntax/error checking
110-
111127
Error checking is supported by `flycheck`.
112128

113129
## Customize
114130

115-
To customize other aspects of its behavior, type `M-x customize-group RET meghanada` .
131+
To customize other aspects of its behavior, type `M-x customize-group RET meghanada`.
116132

117133
## Usage
118134

@@ -124,11 +140,11 @@ Download and install [meghanada-server] jar.
124140

125141
### meghanada-update-server
126142

127-
Download and update [meghanada-server] jar. and restart server process.
143+
Download and update [meghanada-server] jar. and restart the server process.
128144

129145
### meghanada-server-start
130146

131-
Start [meghanada-server][] process and connect to server.
147+
Start [meghanada-server][] process and connect to the server.
132148

133149
`meghanada-mode` call this function by default. when open java file and set `meghanada-mode`.
134150

@@ -192,7 +208,7 @@ Compile project (full build and reindex).
192208

193209
### meghanada-switch-testcase (C-M-,)
194210

195-
Switch testcase or source.
211+
Switch test case or source.
196212

197213
### meghanada-exec-main
198214

@@ -208,11 +224,11 @@ Find usage (method call, field access, class).
208224

209225
### meghanada-search-everywhere
210226

211-
It does a full text search based search (class, method, symbol (field)).
227+
It does a full-text search based search (class, method, symbol (field)).
212228

213229
### meghanada-search-everywhere-ex
214230

215-
It does a full text search expert-mode (Enter a query for Lucene).
231+
It does a full-text search expert-mode (Enter a query for Lucene).
216232

217233
Here is a list of fields that can be used in the search.
218234

@@ -221,9 +237,9 @@ Here is a list of fields that can be used in the search.
221237
* method
222238
* symbol
223239
* usage
224-
* dc (method's or field's declaringClass)
240+
* dc (method's or field's declaring class)
225241

226-
ex. Seach class name contains `Search` .
242+
ex. Seach class name contains `Search`.
227243

228244
```
229245
class:*Search*
@@ -242,19 +258,19 @@ Show type hierarchies and implements interfaces.
242258

243259
### meghanada-run-junit-class (C-c C-c C-t)
244260

245-
Run Junit test class.
261+
Run JUnit test class.
246262

247263
### meghanada-run-junit-test-case (C-c C-c t)
248264

249-
Run Junit testcase (select from imenu).
265+
Run JUnit test case (select from imenu).
250266

251267
### meghanada-debug-junit-class (C-c C-c C-t)
252268

253-
Debug Junit test class.
269+
Debug JUnit test class.
254270

255271
### meghanada-debug-junit-test-case (C-c C-c t)
256272

257-
Debug Junit testcase (select from imenu).
273+
Debug JUnit test case (select from imenu).
258274

259275
### meghanada-run-task (C-c C-v t)
260276

@@ -276,15 +292,15 @@ Format buffer code. The default formatter is `google-java-format`
276292

277293
`meghanada-mode` uses `google-java-format` by default for formatter.
278294

279-
It also supports eclipse formatter.
280-
If you want to customize the formatter, you uses the exported eclipse format settings.
295+
It also supports Eclipse formatter.
296+
If you want to customize the formatter, you use the exported eclipse format settings.
281297
To import the settings, change the name of the exported file to `meghanadaFormatter.xml` and put it in the `project root` or `subproject root`.
282298

283299
## Debug
284300

285-
`meghanada-mode` has no debugger yet. However, external debugger is supported.
301+
`meghanada-mode` has no debugger yet. However, the external debugger is supported.
286302

287-
if you want to debug your code, execute `meghanada-debug-xxxx` function and then use [realgud][] etc.
303+
if you want to debug your code, execute `meghanada-debug-xxxx` function and then use [realgud][], etc.
288304

289305
```
290306
# in Emacs now:
@@ -304,7 +320,7 @@ if you want to debug your code, execute `meghanada-debug-xxxx` function and then
304320

305321
## Troubleshooting
306322

307-
See `*meghanada-server-log*` buffer. or `/tmp/meghanada_server.log`.
323+
See `*meghanada-server-log*` buffer. or `(temporary-file-directory)meghanada_server_(user-uid).log`, e.g. `/tmp/meghanada_server_1000.log`.
308324

309325
Please press `C-g` when emacs seems to hang.
310326

@@ -409,6 +425,6 @@ GPL v3, See [LICENSE](LICENSE) file.
409425
[Gradle]: https://gradle.org
410426
[company-mode]: http://company-mode.github.io/
411427
[flycheck]: http://flycheck.org
412-
[Junit]: http://www.junit.org/
428+
[JUnit]: http://www.junit.org/
413429
[yasnippet]: http://joaotavora.github.io/yasnippet/
414430
[realgud]: https://github.com/realgud/realgud

RELEASES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Version 1.0.14 (2019-04-26)
2+
3+
* works without the project tool (mvn, gradle, etc).
4+
* support java 12 (experimental).
5+
* add jvm option setting (meghanada-jvm-option).
6+
* support company-box.
7+
* fix some bugs and improve stability.
8+
19
# Version 1.0.13 (2019-02-25)
210

311
* support build.gradle.kts.

company-meghanada.el

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
;;; Code:
2727

2828
(eval-when-compile
29-
(require 'cl-lib))
29+
(require 'cl-lib)
30+
(require 'pcase))
3031

3132
(require 'company)
3233
(require 'company-template)
@@ -61,8 +62,6 @@
6162
(defun meghanada-company-enable ()
6263
"Enable auto completion with company."
6364
(company-mode t)
64-
(set (make-local-variable 'company-backends) nil)
65-
(set (make-local-variable 'company-transformers) nil)
6665
(if company-meghanada-prefix-length
6766
(set (make-local-variable 'company-minimum-prefix-length) company-meghanada-prefix-length)
6867
(set (make-local-variable 'company-meghanada-prefix-length) company-minimum-prefix-length))
@@ -75,6 +74,17 @@
7574
(yas-minor-mode t)
7675
(make-local-variable 'yas-minor-mode-map))
7776

77+
(defun make-icon-hash (type)
78+
(let ((kind-val (pcase type
79+
("VARIABLE" 6)
80+
("METHOD" 2)
81+
("CONSTRUCTOR" 2)
82+
("FIELD" 5)
83+
("CLASS" 22)))
84+
(ht (make-hash-table :test 'equal)))
85+
(puthash "kind" kind-val ht)
86+
ht))
87+
7888
(defun company-meghanada--to-candidate (result)
7989
(mapcar (lambda (candidate)
8090
(propertize (nth 1 candidate)
@@ -87,7 +97,9 @@
8797
'return-type
8898
(nth 4 candidate)
8999
'extra
90-
(nth 5 candidate))) result))
100+
(nth 5 candidate)
101+
'lsp-completion-item
102+
(make-icon-hash (nth 0 candidate)))) result))
91103

92104
(defun company-meghanada--to-candidates (output)
93105
(when (> (length output) 0)
@@ -213,7 +225,6 @@
213225
(concat "*" var "#" prefix)))
214226
(t match))))
215227

216-
;; (message (format "match:%s send-keyword:%s" match keyword))
217228
(setq meghanada--sp-prefix keyword)
218229
(cons symbol t))
219230
symbol)))))
@@ -285,9 +296,7 @@
285296
(beginning-of-thing 'symbol)
286297
(end-of-thing 'symbol)
287298
(list 'return-type return-t 'meta meta 'type 'method))))
288-
289299
(when anno
290-
(insert anno)
291300
(company-template-c-like-templatify anno)
292301
(when (and
293302
(> (length extra) 1)
@@ -340,7 +349,6 @@
340349
(meta (get-text-property 0 'meta arg))
341350
(desc (get-text-property 0 'desc arg))
342351
(anno (company-meghanada--annotation arg)))
343-
;;(message (format "@ arg:%s meta:%s desc:%s anno:%s" arg meta desc anno))
344352
(meghanada-autocomplete-resolve-async
345353
type
346354
arg
@@ -362,8 +370,7 @@
362370
(backward-word)
363371
(insert meta)
364372
(insert ";")
365-
(delete-region (point) (+ (point) (length arg)))
366-
)))))
373+
(delete-region (point) (+ (point) (length arg))))))))
367374

368375
(defun company-meghanada (command &optional arg &rest ignored)
369376
(cl-case command
@@ -378,10 +385,7 @@
378385
(ignore-case t)
379386
(sorted t)
380387
(no-cache
381-
(unless
382-
(and
383-
(string= "prefix" meghanada-completion-matcher)
384-
(string= "prefix" meghanada-class-completion-matcher))
388+
(unless (and (string= "prefix" meghanada-completion-matcher) (string= "prefix" meghanada-class-completion-matcher))
385389
t))
386390
(require-match 'never)
387391
(post-completion

0 commit comments

Comments
 (0)