Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
867625ec
Commit
867625ec
authored
Jan 20, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Jan 21, 2021
Browse files
Fix extra inverted comma on autocomplete with autobrackets
parent
891017f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientcompletion.cpp
View file @
867625ec
...
...
@@ -287,10 +287,26 @@ public:
endResetModel
();
}
/**
* @brief return next char *after* the range
*/
static
QString
peekNextChar
(
KTextEditor
::
Document
*
doc
,
const
KTextEditor
::
Range
&
range
)
{
auto
n
=
doc
->
text
(
KTextEditor
::
Range
(
range
.
end
().
line
(),
range
.
end
().
column
(),
range
.
end
().
line
(),
range
.
end
().
column
()
+
1
));
return
n
;
}
void
executeCompletionItem
(
KTextEditor
::
View
*
view
,
const
KTextEditor
::
Range
&
word
,
const
QModelIndex
&
index
)
const
override
{
if
(
index
.
row
()
<
m_matches
.
size
())
view
->
document
()
->
replaceText
(
word
,
m_matches
.
at
(
index
.
row
()).
insertText
);
if
(
index
.
row
()
<
m_matches
.
size
())
{
auto
next
=
peekNextChar
(
view
->
document
(),
word
);
auto
matching
=
m_matches
.
at
(
index
.
row
()).
insertText
;
// if there is already a '"', remove it, this happens with #include "xx.h"
if
(
next
==
QLatin1Char
(
'"'
)
&&
matching
.
endsWith
(
QLatin1Char
(
'"'
)))
{
matching
.
chop
(
1
);
}
view
->
document
()
->
replaceText
(
word
,
matching
);
}
}
void
aborted
(
KTextEditor
::
View
*
view
)
override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment