Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make emacs can navigate codes in a jar file like vim did. #278

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
85cd0b5
Added eclim-run-configuartion. Fixes #244.
nloyola Oct 30, 2015
dcc59ca
added eclim-java-generate-getter
nloyola Nov 8, 2015
2a31fb5
Merge branch 'getter-only'
nloyola Dec 17, 2015
48af1be
Added eclim-java-refactor-move-class
nloyola Nov 7, 2015
0cf5e19
Can assign Eclim project settings.
nloyola Nov 8, 2015
6810921
Ignore errors when deciding whether to handle a file in global-eclim-…
ovy Sep 3, 2015
612eb4f
Make `eclim-problems' correct work properly from the problems buffer. It
ovy Aug 2, 2015
acb9183
Replace distracting "refreshing File" message with small modeline ind…
ovy Aug 2, 2015
03c352b
Some love for the compilation-problems buffer.
ovy Aug 2, 2015
9c4ea63
Add simple commands to move back and forth between problems in curren…
ovy Aug 2, 2015
c0de8ca
Minor: add follow-link=t to javadoc text buttons, allowing left click.
ovy Aug 2, 2015
38b41d7
company-eclim: make ignore-case=nil filter candidates to match prefix.
ovy Aug 7, 2015
d5a3b20
Allow completion after an open bracket or template bracket.
ovy Aug 9, 2015
9392755
Make problems refresh after an automated correction.
ovy Aug 15, 2015
9aab07c
Fix eclim-java-implement; it now uses Eclipse rather than emacs inser…
ovy Aug 18, 2015
f19c4b4
Problem highlights: add variable that causes highlights to be suppres…
ovy Aug 25, 2015
4526880
Add a function to find files by name.
ovy Aug 25, 2015
0f852e7
Tweak for eclim-run-configuartion.
nloyola Dec 17, 2015
35545c6
Correct meta comment for packaging convention
syohex Dec 18, 2015
ad93170
Add autoload cookie for lazy loading
syohex Dec 18, 2015
5461fa7
Use cl-lib macros instead cl.el
syohex Dec 18, 2015
96ef7c5
Add cl-lib dependency
syohex Dec 18, 2015
a9ab83e
Correct argument names
syohex Dec 18, 2015
32d014f
Fix for global variable declarations
syohex Dec 18, 2015
4f2df56
Correct variable name
syohex Dec 18, 2015
258d0ae
Use argument
syohex Dec 18, 2015
c13ad66
Merge pull request #3 from syohex/improve-company-extension
gopar Dec 18, 2015
ba1b224
Merge pull request #4 from syohex/fix-for-free-vars
nloyola Dec 18, 2015
21e67c4
Create setter function
gopar Dec 20, 2015
c889b94
Fixed some compiler warnings.
nloyola Dec 20, 2015
6e0308b
Small change to trigger Travis CI build
nloyola Dec 26, 2015
4d26ff5
Small change to trigger Travis CI build
nloyola Dec 26, 2015
86067cb
Fix for test cases.
nloyola Dec 26, 2015
2fcac97
Forgot to remove debug statement in last commit.
nloyola Dec 26, 2015
4e4adcb
Now points to correct build status page.
nloyola Dec 26, 2015
da0648f
Added new Gitter badge
gitter-badger Dec 26, 2015
de6f6d7
Fixed a bad typo introduced earlier.
nloyola Dec 26, 2015
968da3c
Fix for eclim-run-java-doc.
nloyola Nov 15, 2015
4dcae5a
add support to read source in jar file.
jingtaozf Feb 25, 2016
b1e8af9
bug fix: return type should be array instead of list.
jingtaozf Feb 26, 2016
20d4000
Enhance 'eclim-run-class'
vspinu Mar 18, 2016
241a1a2
Add `eclim-java-browse-documentation-at-point`
vspinu Mar 17, 2016
a370e86
java-import: reorder things to avoid visible excursion to top of buffer.
ovy Sep 13, 2015
03873c4
Open files in archives. Fixes http://github.com/senny/emacs-eclim/iss…
ovy Mar 29, 2016
ce5b462
When find returns multiple archive results, location should be the ar…
ovy Mar 31, 2016
0f81952
Default accepted file regexps should all be extensions (end-of-string).
ovy Mar 29, 2016
357b1bb
Completion: do not refresh problems while inserting the choice.
ovy Sep 12, 2015
3ae5c07
Completion: fix up corner cases in yas template computation.
ovy Aug 30, 2015
de4be90
Added eclim-scala-find-declaration.
lins05 Apr 4, 2016
b6daef5
Completion: allow the user to customize insertion.
ovy Apr 11, 2016
0c9a492
merge from https://github.com/emacs-eclim/emacs-eclim/pull/23
jingtaozf May 3, 2016
74c170d
update problems after a fix.
jingtaozf May 4, 2016
ed109ff
make emacs can navigate codes in a jar file.
jingtaozf Jun 13, 2016
e26323c
make emacs can navigate codes in a jar file.
jingtaozf Jun 13, 2016
71c23ff
fix code style
jingtaozf Jun 13, 2016
dc43b98
fix conflict when merge from upstream.
jingtaozf Jun 14, 2016
549dc0a
Update README.md
jchochli Dec 31, 2015
00d0a92
fix conflict with upstream.
jingtaozf Jun 17, 2016
125384e
make emacs can navigate codes in a jar file.
jingtaozf Jun 13, 2016
c1d1414
make emacs can navigate codes in a jar file.
jingtaozf Jun 13, 2016
7314476
fix code style
jingtaozf Jun 13, 2016
0c95c2f
Merge branch 'master' of github.com:jingtaozf/emacs-eclim
jingtaozf Jun 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

=== New features
* company mode completion can be case insensitive
* added eclim-run-configuartion which runs a run configuration in the
compilation buffer.
* added eclim-java-generate-getter which generates a getter method
for the symbol at point.
* added eclim-java-generate-setter which generates a setter method
for the symbol at point.
* added eclim-java-refactor-move-class which allows moving a top level
class or interface from one package to another.
* added eclim-project-setting-set which can assign an Eclim project
setting.
* Fixed some compiler warnings. Not all compiler warnings were fixed
since those changes could not be tested.

== 0.3

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Development has moved to https://github.com/emacs-eclim/emacs-eclim

[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
[![Build Status](https://travis-ci.org/senny/emacs-eclim.svg?branch=master)](https://travis-ci.org/senny/emacs-eclim)
[![Build Status](https://travis-ci.org/emacs-eclim/emacs-eclim.svg?branch=master)](https://travis-ci.org/emacs-eclim/emacs-eclim)
[![MELPA](http://melpa.org/packages/emacs-eclim-badge.svg)](http://melpa.org/#/emacs-eclim)
[![MELPA Stable](http://stable.melpa.org/packages/emacs-eclim-badge.svg)](http://stable.melpa.org/#/emacs-eclim)

## Overview

[![Join the chat at https://gitter.im/senny/emacs-eclim](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/senny/emacs-eclim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/emacs-eclim/emacs-eclim](https://badges.gitter.im/emacs-eclim/emacs-eclim.svg)](https://gitter.im/emacs-eclim/emacs-eclim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[Eclim](http://eclim.org) is an Eclipse plugin which exposes Eclipse
features through a server interface. When this server is started, the
Expand Down
22 changes: 16 additions & 6 deletions company-emacs-eclim.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;; company-emacs-eclim.el --- an interface to the Eclipse IDE.
;;; company-emacs-eclim.el --- an interface to the Eclipse IDE.
;;
;; Copyright (C) 2009-2012 Fredrik Appelberg
;; Copyright (C) 2013-2014 Dmitry Gutov
Expand All @@ -16,7 +16,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Description
;;; Commentary:
;;
;; company-emacs-eclim.el -- company-mode backend that replaces company-eclim
;;
Expand All @@ -26,26 +26,30 @@
;;
;; Minimum company-mode version required: 0.7.

;;; Code:

;;* Eclim Company

(require 'eclim)
(require 'eclim-completion)
(require 'eclim-java)
(require 'company)
(require 'cl-lib)

(defcustom company-emacs-eclim-ignore-case t
"If t, case is ignored in completion matches."
:group 'eclim-company
:type '(choice (const :tag "Yes" t)
(const :tag "No" nil)))

;;;###autoload
(defun company-emacs-eclim-setup ()
"Convenience function that adds company-emacs-eclim to the list
of available company backends."
(setq company-backends
(cons 'company-emacs-eclim
(remove-if (lambda (b) (find b '(company-nxml company-eclim)))
company-backends))))
(cl-remove-if (lambda (b) (cl-find b '(company-nxml company-eclim)))
company-backends))))

(defun company-emacs-eclim--before-prefix-in-buffer (prefix)
"Search for the text before prefix that may be included as part of completions"
Expand Down Expand Up @@ -80,17 +84,22 @@
(mapcar
(lambda (candidate)
(annotate (without-redundant-prefix candidate)))
(eclim--completion-candidates)))))
;; Company says backend is responsible for filtering prefix case.
(if company-emacs-eclim-ignore-case
(eclim--completion-candidates)
(cl-remove-if-not #'(lambda(str) (string-prefix-p prefix str))
(eclim--completion-candidates)))))))

(defun company-emacs-eclim--annotation (candidate)
(let ((str (get-text-property 0 'eclim-meta candidate)))
(when (and str (string-match "(" str))
(substring str (match-beginning 0)))))

;;;###autoload
(defun company-emacs-eclim (command &optional arg &rest ignored)
"`company-mode' back-end for Eclim completion"
(interactive (list 'interactive))
(case command
(cl-case command
(interactive (company-begin-backend 'company-emacs-eclim))
(prefix (let ((start (and eclim-mode
(eclim--accepted-p (buffer-file-name))
Expand All @@ -115,3 +124,4 @@
(eclim--completion-action beg end)))

(provide 'company-emacs-eclim)
;;; company-emacs-eclim.el ends here
4 changes: 2 additions & 2 deletions eclim-ant.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ stored. It is used globally for all eclim projects."
(eclim--check-project project)
(mapcar (lambda (line)
(split-string line "|"))
(eclim--call-process "ant_validate" "-p" project "-f" file)))
(eclim--call-process "ant_validate" "-p" project "-f" buildfile)))

(defun eclim/ant-target-list (project buildfile)
(eclim--check-project project)
Expand All @@ -89,7 +89,7 @@ buffer. The results are displayed in a dedicated compilation buffer."
(dolist (line (eclim/ant-validate project file))
(insert (eclim--convert-find-result-to-string line))
(newline)))
(beginning-of-buffer)
(goto-char (point-min))
(compilation-mode))

(defun eclim-ant-run (target)
Expand Down
74 changes: 57 additions & 17 deletions eclim-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@

(defvar eclim--completion-candidates nil)

(defvar eclim-insertion-functions nil
"Use one of these functons when inserting a completion in
preference to yasnippet or raw insertion. Each will be called
with a yas template and should return nil iff it cannot do the
insertion (e.g. wrong mode). For example, `eclim-completion-insert-empty'
removes all arguments before inserting.")

(defun eclim--complete ()
(setq eclim--is-completing t)
(unwind-protect
Expand All @@ -75,6 +82,7 @@
(setq eclim--is-completing nil)))

(defun eclim--completion-candidates-filter (c)
"Rejects completion candidate C (non-nil return) in certain situations."
(case major-mode
((xml-mode nxml-mode) (or (search "XML Schema" c)
(search "Namespace" c)))
Expand Down Expand Up @@ -142,15 +150,24 @@ buffer."

(defun eclim--completion-yasnippet-convert (completion)
"Convert a completion string to a yasnippet template"
(apply #' concat
(loop for c across (replace-regexp-in-string ", " "," completion)
collect (case c
(40 "(${")
(60 "<${")
(44 "}, ${")
(41 "})")
(62 "}>")
(t (char-to-string c))))))
(let ((level 0))
(replace-regexp-in-string
;; ORs: 1) avoid empty case; 2) eat spaces sometimes; 3) not when closing.
"()\\|[(<,] *\\|[)>]"
#'(lambda (m)
(let ((c (string-to-char m)) (repl m))
(unless (string= m "()")
(when (memq c '(?\( ?<)) (incf level))
(when (<= level 1) (setq repl (case c
(?\( "(${")
(?< "<${")
(?, "}, ${")
(?\) "})")
(?> "}>")
(t (error "RE/case mismatch")))))
(when (memq c '(?\) ?>)) (decf level)))
repl))
completion)))

(defvar eclim--completion-start)

Expand All @@ -161,6 +178,15 @@ buffer."
(case major-mode
((java-mode javascript-mode js-mode ruby-mode groovy-mode php-mode c-mode c++-mode scala-mode)
(progn
;; Allow completion after open bracket. Eclipse/eclim do.
(when (or (eq ?\( (char-before))
;; Template? Technically it could be a less-than sign
;; but it's unlikely the user completes there and
;; no particular harm done.
(and (eq ?\< (char-before))
(memq major-mode
'(java-mode c++-mode goovy-mode))))
(backward-char 1))
(ignore-errors (beginning-of-thing 'symbol))
;; Completion candidates for annotations don't include '@'.
(when (eq ?@ (char-after))
Expand All @@ -183,9 +209,12 @@ buffer."
(package (if (and rest (string-match "\\w+\\(\\.\\w+\\)*" rest)) rest nil))
(template (eclim--completion-yasnippet-convert insertion)))
(delete-region beg end)
(if (and eclim-use-yasnippet template (featurep 'yasnippet) yas-minor-mode)
(unless (loop for f in eclim-insertion-functions thereis
(funcall f template))
(if (and eclim-use-yasnippet template
(featurep 'yasnippet) yas-minor-mode)
(yas/expand-snippet template)
(insert insertion))
(insert insertion)))
(when package
(eclim-java-import
(concat package "." (substring insertion 0 (or (string-match "[<(]" insertion)
Expand All @@ -212,12 +241,13 @@ buffer."
(backward-char)))))

(defun eclim--completion-action (beg end)
(case major-mode
('java-mode (eclim--completion-action-java beg end))
('groovy-mode (eclim--completion-action-java beg end))
((c-mode c++-mode) (eclim--completion-action-java beg end))
('nxml-mode (eclim--completion-action-xml beg end))
(t (eclim--completion-action-default))))
(let ((eclim--is-completing t)) ;; an import should not refresh problems
(case major-mode
('java-mode (eclim--completion-action-java beg end))
('groovy-mode (eclim--completion-action-java beg end))
((c-mode c++-mode) (eclim--completion-action-java beg end))
('nxml-mode (eclim--completion-action-xml beg end))
(t (eclim--completion-action-default)))))

(defun eclim--render-doc (str)
"Performs rudimentary rendering of HTML elements in
Expand All @@ -238,4 +268,14 @@ completion candidates list."
(when doc
(eclim--render-doc doc))))

(defun eclim-completion-insert-empty (template)
"Insert a completion erasing arguments, leaving point inside argument list
or outside if empty. Meant for `eclim-insertion-functions'."
(save-match-data
(if (not (string-match "${.*}" template))
(insert template)
(insert (substring template 0 (match-beginning 0)))
(save-excursion (insert (substring template (match-end 0))))))
t)

(provide 'eclim-completion)
11 changes: 11 additions & 0 deletions eclim-java-run.el
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,16 @@
classpath
project-dir))))

(defun eclim-run-configuartion (configuration-name)
"Runs the configuration given in CONFIGURATION-NAME in the compilation buffer."
(interactive (list (eclim-java-run--ask-which-configuration)))
(let* ((configurations (eclim-java-run--load-configurations (eclim-project-name)))
(configuration (eclim-java-run--configuration configuration-name configurations))
(project-dir (eclim-java-run--project-dir (eclim-project-name)))
(classpath (eclim/java-classpath (eclim-project-name)))
(default-directory project-dir)
(command (eclim-java-run--command configuration (eclim-java-run--java-vm-args classpath))))
(compile command)))

(provide 'eclim-java-run)
;;; eclim-java-run.el ends here
Loading