jdee icon indicating copy to clipboard operation
jdee copied to clipboard

Indentation for annotations

Open plandes opened this issue 8 years ago • 6 comments

Indentation for annotations doesn't work properly.

plandes avatar Jul 15 '15 12:07 plandes

Do you have an example file where it fails? Indentation for annotations for me is working correctly. I can try to fix it.

dakrone avatar Aug 14 '15 03:08 dakrone

It happens when there is a newline separating multiple parameters.

public class Yada {
    @AnAnnotation(param1=1,
          param2=2)
          public void run() {
    }
};

plandes avatar Aug 14 '15 11:08 plandes

I believe this is due to a bug in the function c-guess-basic-syntax that handles Java annotations. Specifically, the listed case 5N should be something like the following. This change changes the syntax so that the indentation will be relative to the start of the entire preceding annotation, not just the prior line of the annotation.

 ;;CASE 5N: We are at a topmost continuation line and the only
 ;;preceding items are annotations.
 ((and (c-major-mode-is 'java-mode)
       (setq placeholder (point))
       (c-beginning-of-statement-1)
       (progn
     (while (and (c-forward-annotation))
       (c-forward-syntactic-ws))
     t)
       (prog1
       (>= (point) placeholder)
     (goto-char placeholder)))
  ;; (c-add-syntax 'annotation-top-cont (c-point 'boi))
      (prog1
          (c-add-syntax 'annotation-top-cont (progn (c-beginning-of-statement-1) (point)))
        (goto-char placeholder))
      )

oldButNotWise avatar Dec 21 '15 23:12 oldButNotWise

Bug fixed in future Emacs version. See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22358 for more details.

oldButNotWise avatar Feb 12 '16 15:02 oldButNotWise

I am having an issue with default interface methods. They are being indented to the absolute left. screenshot from 2017-01-31 20-14-18

Where can I find documentation to fix this? Is this a jdee issue at all? Where to ask for help?

purukaushik avatar Feb 01 '17 03:02 purukaushik