Bug 338196 - path completion does not escape special characters
Summary: path completion does not escape special characters
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: 4.5.2
Platform: Other Linux
: LO normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2014-08-11 13:54 UTC by Barade
Modified: 2017-07-18 09:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barade 2014-08-11 13:54:52 UTC
When completing a file path which contains ( or ) for example it does not escape them with \.

Reproducible: Always
Comment 1 Akshay 2016-04-25 19:15:49 UTC
please check whether this has been fixed in the latest versions of Kdevelop.
Comment 2 Kevin Funk 2016-09-08 19:43:59 UTC
@Barade: Which compiler supports this?

Citing https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html:
"However, if backslashes occur within file, they are considered ordinary text characters, not escape characters. None of the character escape sequences appropriate to string constants in C are processed. Thus, #include "x\n\\y" specifies a filename containing three backslashes. (Some systems interpret ‘\’ as a pathname separator. All of these also interpret ‘/’ the same way. It is most portable to use only ‘/’.)"

Considering this invalid.
Comment 3 Barade 2016-09-09 09:50:21 UTC
Did you even read that it is about the CMake completion tool and not about C++?
Comment 4 Kevin Funk 2016-09-09 10:04:08 UTC
Cough, no. Sorry, I was in C++ mode here :)

Reproduced the problem in a CMakeLists.txt.

MWE:
Create a file foo(.cpp.

Then in the accompanying CMakeLists.txt file:
set(FOO
    foo<CURSOR>
)

=> Will insert foo(.cpp.
=> CMake reports: Parse error.  Function missing ending ")".  End of file reached.
Comment 5 Kevin Funk 2016-11-28 15:11:13 UTC
Hint: Have a look at CMakeCodeCompletionModel::completionInvoked in kdevelop.git
Comment 6 Kevin Funk 2017-07-13 19:57:20 UTC
Git commit db14d0e4989e790b341a88ebc3f8c28896cc58ea by Kevin Funk, on behalf of Geetam Chawla.
Committed on 13/07/2017 at 19:56.
Pushed by kfunk into branch '5.1'.

CMake code completion: Add missing chars to be escaped

Summary:
List of chars to be escaped is taken from: https://cmake.org/Wiki/CMake/Language_Syntax

> To use literally any of "()#$^, escape the character with a backslash

Test Plan: created a file foo"()#$^.cpp, the chars are escaped properly.

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: kdevelop-devel

Differential Revision: https://phabricator.kde.org/D6689

M  +4    -3    projectmanagers/cmake/cmakecodecompletionmodel.cpp

https://commits.kde.org/kdevelop/db14d0e4989e790b341a88ebc3f8c28896cc58ea