[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-25 Thread Waqar Ahmed
https://bugs.kde.org/show_bug.cgi?id=456819

Waqar Ahmed  changed:

   What|Removed |Added

 Resolution|--- |FIXED
  Latest Commit||https://invent.kde.org/fram
   ||eworks/syntax-highlighting/
   ||commit/656fbbcfd456f07bb7e1
   ||fc432cbe4ef6a16e0bcd
 Status|ASSIGNED|RESOLVED

--- Comment #10 from Waqar Ahmed  ---
Git commit 656fbbcfd456f07bb7e1fc432cbe4ef6a16e0bcd by Waqar Ahmed.
Committed on 25/08/2022 at 16:28.
Pushed by waqar into branch 'master'.

Change singleLineComments to be AfterWhiteSpace for c-like langs

clang-format, the most commonly used formatter these days insists on
comments being properly indented. Similarly other formatters like
prettier also insist that comments are aligned.
Related: bug 438744

M  +1-1autotests/repository_test.cpp
M  +2-2data/syntax/c.xml
M  +2-2data/syntax/cpp.xml
M  +2-2data/syntax/cs.xml
M  +2-2data/syntax/d.xml
M  +2-2data/syntax/dart.xml
M  +2-2data/syntax/go.xml
M  +2-2data/syntax/isocpp.xml
M  +2-2data/syntax/java.xml
M  +2-2data/syntax/javascript.xml
M  +2-2data/syntax/php.xml
M  +2-2data/syntax/rust.xml
M  +2-2data/syntax/typescript.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/656fbbcfd456f07bb7e1fc432cbe4ef6a16e0bcd

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-25 Thread Christoph Cullmann
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #9 from Christoph Cullmann  ---
Git commit 93d6b7aebe7940cc63657f6d8df141fe02dee964 by Christoph Cullmann, on
behalf of Waqar Ahmed.
Committed on 25/08/2022 at 16:14.
Pushed by cullmann into branch 'master'.

Improve singleline selection commenting

Currently, if you have a selection and "afterwhitespace" turned on for
the language that you are using and you do a selection and comment it
out it leads to a really bad result with languages like C/C++. Following
code:

```c++
for (auto x : list) {
if (x > 1)
printf("%d", x);
}
```

will become

```c++
// for (auto x : list) {
// if (x > 1)
// printf("%d", x);
// }
```

Which makes zero sense. With this change, the comment marker will be
placed at the smallest indent found in the selection, which can be 0.
For the above code, the result will be:

```c++
// for (auto x : list) {
//if (x > 1)
//  printf("%d", x);
// }
```

Comments are nicely aligned, and we keep the indentation.

This behaviour is consistent with other editors for e.g., vscode,
sublime. Its also compatible with what for e.g clang-format or prettier
do, i.e., align the comments according to indentation setting.
Related: bug 438744

M  +3-3autotests/src/katedocument_test.cpp
M  +44   -15   src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/93d6b7aebe7940cc63657f6d8df141fe02dee964

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-25 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #8 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/409

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-18 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=456819

Bug Janitor Service  changed:

   What|Removed |Added

 Status|CONFIRMED   |ASSIGNED

--- Comment #7 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/341

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-10 Thread Ahmad Samir
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #6 from Ahmad Samir  ---
Git commit fceb6fef10932a5b6aaf698c102f05bbed04e12a by Ahmad Samir.
Committed on 10/08/2022 at 18:20.
Pushed by cullmann into branch 'master'.

KateDocument: always add space after single line comment start marker

So that if you have code:
if (foo) {
do_something();
}

commenting out the second line, it would become (assuming the
position="afterwhitespace" option is set in c.xml):
if (foo) {
// do_something();
}

This works better with clang-format, which insists on reformatting this:
//do_something();
to
// do_something();

to the version with the space, "// ".

Fix unittests.

M  +1-1autotests/src/katedocument_test.cpp
M  +1-2src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/fceb6fef10932a5b6aaf698c102f05bbed04e12a

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-08 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #5 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/397

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-08 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #4 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/289

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-08-08 Thread Ahmad Samir
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #3 from Ahmad Samir  ---
Git commit 178c4dfbf4eb5ad7c5aef4838f190f717f97766f by Ahmad Samir.
Committed on 08/08/2022 at 21:30.
Pushed by ahmadsamir into branch 'master'.

clang-format.cmake: don't change spaces after '//' in code comments

For example, if you have:
//This is a comment

now clang-format won't change it to:
// This is a comment

We're mainly interested in formatting the code, not the comments, so that
cuts down on some noise when running clang-format.

M  +5-0kde-modules/clang-format.cmake

https://invent.kde.org/frameworks/extra-cmake-modules/commit/178c4dfbf4eb5ad7c5aef4838f190f717f97766f

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-07-24 Thread Ahmad Samir
https://bugs.kde.org/show_bug.cgi?id=456819

--- Comment #2 from Ahmad Samir  ---
(In reply to Christoph Cullmann from comment #1)
> Does it behave better if you pass the singleLine tag the
> position="afterwhitespace" attribute in the XML highlighting file?

Yeah, that seems to have an effect:
if (!iconNo.isNull()) {
buttonNoGui.setIconName(iconNo);
}

becomes:
if (!iconNo.isNull()) {
//buttonNoGui.setIconName(iconNo);
}

but, of course, clang(pesky)-fromat still complains and changes it to:
// buttonNoGui.setIconName(iconNo);

so it would probably need another change in the indenter js code to add "// "
instead of just "//".
(I don't know javascript well enough to try hacking the indenter js code).

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-07-24 Thread Christoph Cullmann
https://bugs.kde.org/show_bug.cgi?id=456819

Christoph Cullmann  changed:

   What|Removed |Added

 CC||cullm...@kde.org

--- Comment #1 from Christoph Cullmann  ---
Does it behave better if you pass the singleLine tag the
position="afterwhitespace" attribute in the XML highlighting file?

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-ktexteditor] [Bug 456819] Commenting out code in C++ source files adds // to the very beginning of the line

2022-07-18 Thread Nate Graham
https://bugs.kde.org/show_bug.cgi?id=456819

Nate Graham  changed:

   What|Removed |Added

 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1
 CC||n...@kde.org

-- 
You are receiving this mail because:
You are watching all bug changes.