Patch - completion of for-each types

[email protected] (Przemysław Wojnowski)
Newsgroups gmane.emacs.jdee.devel
Message-ID <[email protected]>
Hi!
In function jde-parse-valid-declaration-at regexp which should match
type of iterated elements in for-each loop is too aggressive and doesn't
match method calls after colon. For example:
for (Integer x : getSth(anoter()).list()) {
   print(x.  // here completion will not work
}

This patch removes check for characters after the colon. It's not ideal,
but allows to correctly recognize such type declarations.

Another part just removes unnecessary "concat".

The patch is against the 2.4.0 branch.

Regards,
Przemek

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
jdee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jdee-devel
jde-parse.diff (text/x-diff, 1.4 KB)
Index: lisp/jde-parse.el
===================================================================
--- lisp/jde-parse.el	(revision 118)
+++ lisp/jde-parse.el	(working copy)
@@ -694,10 +694,10 @@
 			       "\\(" jde-parse-java-symbol-re "[ \t\n\r]*,[ \t\n\r]*\\)*"
                               (jde-parse-double-backslashes varname) 
                               "[]?[ \t\n\r]*[,;]"))
-       ;; Parse jdk1.5 for (Type val : collection) {
-       (looking-at (concat "\\(" jde-parse-java-symbol-declare-re "\\)[ \t\n\r]+"
-                           varname "[ \t\n\r]*:[ \t\n\r]*"
-                           "\\(" jde-parse-java-symbol-re "[,{} \t\n\r]*\\)+" ")")))
+           ;; Parse jdk1.5 for (Type val : collection) {
+           (looking-at (concat "\\(" jde-parse-java-symbol-declare-re "\\)[ \t\n\r]+"
+                               varname "[ \t\n\r]*:")))  ;[ \t\n\r]*"
+                               ;"\\(" jde-parse-java-symbol-re "[,{} \t\n\r]*\\)+" ")")))
           (let ((type (match-string 1))
                 (type-pos (match-beginning 1)))
             (goto-char type-pos)
@@ -753,7 +753,7 @@
 could be found."
   (save-excursion
     (let ((symbol-list-entry-re
-	   (concat (concat jde-parse-java-symbol-re "[ \t\n\r]*,[ \t\n\r]*")))
+	   (concat jde-parse-java-symbol-re "[ \t\n\r]*,[ \t\n\r]*"))
 	  (orgpt (point))
 	   found pos resname foundpt lastpos)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.