# Improve Comments and Auto-format behaviour

**URL:** <https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332>\
**Category:** Feature Request\
**Tags:** feature-request, tracked, katalon-studio\
**Created:** [September 20, 2018, 3:15pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332 "2018-09-20T15:15:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Schmidt](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/paul_schmidt/32/2124_2.png) [@Paul\_Schmidt](https://forum.katalon.com/u/Paul_Schmidt)\
**Post date:** [September 20, 2018, 3:15pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/1 "2018-09-20T15:15:36Z")

</div>

Hello,

I’d like to present the following four improvement suggestions to you that came up during our daily work with Katalon Studio. All off them are connected to comments and auto-formatting.

**1. Creation of multiline comments for reports**

We frequently use the generated PDF reports. In some cases, we add comments that extend the usual line with by far. Currently we need to put them in a single line that becomes really long. So I’d like to suggest to implement multi-line comments such as /\* \*/ that are displayed at the report.

```auto
' A comment can get reeeeally long and extends the usual line with by far. I hope you see in this tiny example. But when you use longer descriptions, ....'

```

Probably the following syntax could be used

```auto
/'
 ' A comment can get reeeeally long
 ' But here we can put it in more than one line
 ' I guess you see.
 '/

```

We cannot use the usual java comment since they are not displayed at the report and due to the issue suggested in 2.

**2. Improve auto formating**

We really like the auto-formating function in test cases using Ctrl + Shift + F. The only problem is, that comment that do not start with a single quotation mark are getting replaced at the end of the test case. It would be good to avoid this behaviour and let the comments stay at their position. See the following two snippets that could come from any test case. A far as i figured out, this behaviour occurs only in test cases.

_Before auto-format_

```auto
if(2 > 3){
	callAMethod()
}else{
	callOtherMethod()
}

/**
 * Calculates sth
 */
int callAMethod(){
	// My Variable
	int i = 5
}

/*
 * Calculates sth else
 */
int callOtherMethod(){
	/*
	 * Longer comment inside callOtherMethod()
	 */
	int y = 7
}

```

```auto
if (2 > 3) {
    callAMethod()
} /**
 * Calculates sth
 */
// My Variable
/*
 * Calculates sth else
 */
/*
	 * Longer comment inside callOtherMethod()
	 */
else {
    callOtherMethod()
}

int callAMethod() {
    int i = 5
}

int callOtherMethod() {
    int y = 7
}

```

_After auto-format_

**3. Auto format for imports**

Another useful function is Organize Imports (Ctrl + Shift + O). Besides the removal of unused imports it also inserts an empty line between different types of imports. When running auto format afterwards, the line disappears. From my point of view it would good to keep it or even add it when running the auto format.

_After running Organize Imports its fine_

```auto
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement

import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

```

_Running Auto format on the code causes_

```auto
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

```

I know this is not a major feature, but at least nice to have.

**4. Having the setting to run Auto format and Organize imports automatically when we save a file**

At the end of the day it would be nice to have a setting so Auto format and Organize imports is done automatically when saving a file.

Kind Regards,

Paul

---

<div class="post-metadata">

**Author:** ![ntriadi](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@ntriadi](https://forum.katalon.com/u/ntriadi)\
**Post date:** [February 1, 2019, 11:18pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/2 "2019-02-01T23:18:36Z")

</div>

Auto-Formatting = Having feature to DISABLE the auto-formatting will be significant improvement to the studio I have the same issues and it is extremely frustrating during test development + refactoring that the studio always automatically reformats, rearranges and messes up our script code  
😖

---

<div class="post-metadata">

**Author:** ![ouassa.h](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/ouassa.h/32/4178_2.png) [@ouassa.h](https://forum.katalon.com/u/ouassa.h)\
**Post date:** [July 25, 2019, 9:39pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/3 "2019-07-25T21:39:25Z")

</div>

Any update for this

---

<div class="post-metadata">

**Author:** ![Luka\_Mlikota](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/luka_mlikota/32/11085_2.png) [@Luka\_Mlikota](https://forum.katalon.com/u/Luka_Mlikota)\
**Post date:** [January 30, 2020, 11:48am UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/4 "2020-01-30T11:48:29Z")

</div>

No, they don’t care. I’ve lost half of day yesterday because of their auto formatting feature which removed parenthesis on assert statement. Just wow!

---

<div class="post-metadata">

**Author:** ![jim.sears7](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jim.sears7/32/12464_2.png) [@jim.sears7](https://forum.katalon.com/u/jim.sears7)\
**Post date:** [July 29, 2020, 11:25pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/5 "2020-07-29T23:25:20Z")

</div>

Is there an update for this issue? Its been going on 2 years now. In my case, the code formatter is deleting commented code even if it isn’t at the end of the script. I know the simple answer is not use the formatter but it would be nice to have working features…

---

<div class="post-metadata">

**Author:** ![obarquero](https://avatars.discourse-cdn.com/v4/letter/o/ecc23a/32.png) [@obarquero](https://forum.katalon.com/u/obarquero)\
**Post date:** [October 30, 2020, 3:16pm UTC](https://forum.katalon.com/t/improve-comments-and-auto-format-behaviour/13332/6 "2020-10-30T15:16:27Z")

</div>

Hi All,

I saw this post while looking for ways how to comment few lines on a script. Turned out you can do it by using the following:  
/\* line  
line  
line  
line \*/  
It worked for me and wanted to share with you all. Cheers.  
It worked for me.
