Version: 4.0.0 (using KDevPlatform 1.0.0) (using 4.3.4 (KDE 4.3.4), Debian packages) Compiler: cc OS: Linux (x86_64) release 2.6.32-3-amd64 In CMake files, after a multi-line function call, code completion stops working properly. To reproduce: Create an empty .cmake file. Press Ctrl-Space. The list of CMake commands appears. Add this line to the file: add_executable(foo foo.cpp) Move cursor to end of file and press Ctrl-Space. A list of commands appears. Now change the add_executable call to be multi-line: add_executable(foo foo.cpp ) Move cursor to end of file and press Ctrl-Space. A list of paths or variables will appear, because KDevelop thinks the cursor is still inside the add_executable command. It's probably incorrect logic for setting m_inside in CMakeCodeCompletionModel::completionInvoked.
completionInvoked is doing its own half-assed attempt at parsing, searching for balanced parentheses. It would be hard to get that right in all cases, including parentheses in comments or string literals. The file was already tokenized, parsed, and converted into an AST. Why not use that instead of searching for tokens here again? I thought of looking at the ranges in CMakeFunctionDesc to know if the cursor is inside a function or not. But it looks like the CMakeFunctionDesc go away after initial parsing, or at least they aren't easily accessible from completionInvoked; and either way I now notice the fatal flaw in my plan: CMake files are *not* re-parsed during typing...
Git commit d4aeab4ae4ddca67c5d337bcbf08ca611d949893 by Aleix Pol. Committed on 08/03/2011 at 02:43. Pushed by apol into branch '4.2'. Properly figure out if we're in a command or not. BUG: 235685 M +13 -3 projectmanagers/cmake/cmakecodecompletionmodel.cpp http://commits.kde.org/kdevelop/d4aeab4ae4ddca67c5d337bcbf08ca611d949893