Bug 526793

Summary: The code within @formatter:off block gets formatted when "Duplicate Lines" command is applied
Product: [Eclipse Project] JDT Reporter: Dmitry Katsubo <dma_k>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, mateusz.matela
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
Java snippet
none
Initial state
none
Final state after Ctrl-D none

Description Dmitry Katsubo CLA 2017-11-03 04:43:36 EDT
Created attachment 271309 [details]
Java snippet

Initial setup:

* Some code formatting rules, where "Off/On Tags" settings contain the following:
  Off tag: @formatter:off
  On tag: @formatter:on

* Code fragment like in attached example.java.

Steps:

* Select complete Java function (see ).
* Press Ctrl-D ("Duplicate lines")

Actual: Newly inserted lines are formatted not taking into account "@formatter:off" directive.

Expected: As given lines are already formatted according to formatting rules, the lines are duplicated literally.
Comment 1 Dmitry Katsubo CLA 2017-11-03 04:44:10 EDT
Created attachment 271310 [details]
Initial state
Comment 2 Dmitry Katsubo CLA 2017-11-03 04:44:39 EDT
Created attachment 271311 [details]
Final state after Ctrl-D
Comment 3 Mateusz Matela CLA 2017-11-08 16:03:44 EST
Moving to jdt-text.
Core formatter is not invoked in this scenario, there's a separate mechanism for fixing indentation. I'm afraid it could be quite messy making that mechanism respect formatter:off tags.
Comment 4 Dmitry Katsubo CLA 2018-08-28 09:48:50 EDT
Still an issue in Eclipse 4.8.0.v20180611-0656 / JDT 3.14.0.v20180611-0500.
Comment 5 Eclipse Genie CLA 2020-09-09 10:26:29 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Dmitry Katsubo CLA 2020-09-10 07:02:14 EDT
I have tested the issue on Eclipse v4.14.0.v20191210-0610 (build I20191210-0610) and the issue is still there.
Comment 7 Eclipse Genie CLA 2023-02-08 12:11:26 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Dmitry Katsubo CLA 2023-02-12 20:26:06 EST
I have tested with Eclipse Platform v4.26.0.v20221123-1800 and the issue is there.