Skip to content
GitLab
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
b0129eea
Commit
b0129eea
authored
Oct 09, 2022
by
Waqar Ahmed
Committed by
Christoph Cullmann
Oct 10, 2022
Browse files
LSP: Avoid triggering signature help all the time
In some cases it can lead to really weird results.
BUG: 460113
parent
99e8066a
Pipeline
#245297
passed with stage
in 20 minutes and 50 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientcompletion.cpp
View file @
b0129eea
...
...
@@ -298,6 +298,10 @@ public:
qCInfo
(
LSPCLIENT
)
<<
"should start "
<<
userInsertion
<<
insertedText
;
if
(
!
userInsertion
||
!
m_server
||
insertedText
.
isEmpty
())
{
if
(
!
insertedText
.
isEmpty
()
&&
m_triggersSignature
.
contains
(
insertedText
.
back
()))
{
m_triggerSignature
=
true
;
return
true
;
}
return
false
;
}
...
...
@@ -321,6 +325,20 @@ public:
qCInfo
(
LSPCLIENT
)
<<
"completion invoked"
<<
m_server
;
if
(
it
==
UserInvocation
&&
range
.
isEmpty
()
&&
m_signatureHelp
)
{
// If this is a user invocation (ctrl-space), check the last non-space char for sig help trigger
QChar
c
;
int
i
=
range
.
start
().
column
()
-
1
;
int
ln
=
range
.
start
().
line
();
for
(;
i
>=
0
;
--
i
)
{
c
=
view
->
document
()
->
characterAt
(
KTextEditor
::
Cursor
(
ln
,
i
));
if
(
!
c
.
isSpace
())
{
break
;
}
}
m_triggerSignature
=
m_triggersSignature
.
contains
(
c
);
}
// maybe use WaitForReset ??
// but more complex and already looks good anyway
auto
handler
=
[
this
](
const
QList
<
LSPCompletionItem
>
&
completion
)
{
...
...
@@ -377,10 +395,10 @@ public:
auto
position
=
view
->
cursorPosition
();
auto
cursor
=
qMax
(
range
.
start
(),
qMin
(
range
.
end
(),
position
));
m_manager
->
update
(
document
,
false
);
if
(
!
m_triggerSignature
)
{
m_handle
=
m_server
->
documentCompletion
(
document
->
url
(),
{
cursor
.
line
(),
cursor
.
column
()},
this
,
handler
);
}
if
(
m_signatureHelp
)
{
m_handle
=
m_server
->
documentCompletion
(
document
->
url
(),
{
cursor
.
line
(),
cursor
.
column
()},
this
,
handler
);
if
(
m_signatureHelp
&&
m_triggerSignature
)
{
m_handleSig
=
m_server
->
signatureHelp
(
document
->
url
(),
{
cursor
.
line
(),
cursor
.
column
()},
this
,
sigHandler
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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