Skip to content

Snippet fixes

Waqar Ahmed requested to merge work/fix-snippets into master

If you have some text on a line:

func()

and the cursor is in between the parenthesis and you try to invoke a snippet, kate fails to do so because of what the completionRange method was doing i.e., trying to select the full line range which imo sounds not very smart.

It also leads to incorrect text replacement after execution of a snippet as the range could be anything.

To test, create a snippet "qst" that completes to QStringLiteral(""). Then place your cursor in func() and type qst. Nothing shows up. Add spaces between parenthesis, snippet will now show up but when you execute it, it results in tringLiteral("").


Second commit:

highlightingModeAt is a bad choice because it could be that it returns ISO C++ for some location, but the snippet wants C++. This is just bad, the user should not need to care about these details. Instead just use the document mode.

Edited by Waqar Ahmed

Merge request reports