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
f69ac7ac
Commit
f69ac7ac
authored
Dec 13, 2021
by
Mark Nauwelaerts
Browse files
lspclient: send didSave notification if so requested
parent
f932b667
Pipeline
#109990
passed with stage
in 4 minutes and 22 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientserver.cpp
View file @
f69ac7ac
...
...
@@ -1255,7 +1255,8 @@ private:
{
QStringLiteral
(
"documentSymbol"
),
QJsonObject
{{
QStringLiteral
(
"hierarchicalDocumentSymbolSupport"
),
true
}}
},
{
QStringLiteral
(
"publishDiagnostics"
),
QJsonObject
{{
QStringLiteral
(
"relatedInformation"
),
true
}}},
{
QStringLiteral
(
"codeAction"
),
codeAction
},
{
QStringLiteral
(
"semanticTokens"
),
semanticTokens
}
{
QStringLiteral
(
"semanticTokens"
),
semanticTokens
},
{
QStringLiteral
(
"synchronization"
),
QJsonObject
{{
QStringLiteral
(
"didSave"
),
true
}}},
},
},
{
QStringLiteral
(
"window"
),
...
...
@@ -1475,7 +1476,9 @@ public:
void
didSave
(
const
QUrl
&
document
,
const
QString
&
text
)
{
auto
params
=
textDocumentParams
(
document
);
params
[
QStringLiteral
(
"text"
)]
=
text
;
if
(
!
text
.
isNull
())
{
params
[
QStringLiteral
(
"text"
)]
=
text
;
}
send
(
init_request
(
QStringLiteral
(
"textDocument/didSave"
),
params
));
}
...
...
addons/lspclient/lspclientservermanager.cpp
View file @
f69ac7ac
...
...
@@ -833,6 +833,7 @@ private:
connect
(
doc
,
&
KTextEditor
::
Document
::
aboutToClose
,
this
,
&
self_type
::
untrack
,
Qt
::
UniqueConnection
);
connect
(
doc
,
&
KTextEditor
::
Document
::
destroyed
,
this
,
&
self_type
::
untrack
,
Qt
::
UniqueConnection
);
connect
(
doc
,
&
KTextEditor
::
Document
::
textChanged
,
this
,
&
self_type
::
onTextChanged
,
Qt
::
UniqueConnection
);
connect
(
doc
,
&
KTextEditor
::
Document
::
documentSavedOrUploaded
,
this
,
&
self_type
::
onDocumentSaved
,
Qt
::
UniqueConnection
);
// in case of incremental change
connect
(
doc
,
&
KTextEditor
::
Document
::
textInserted
,
this
,
&
self_type
::
onTextInserted
,
Qt
::
UniqueConnection
);
connect
(
doc
,
&
KTextEditor
::
Document
::
textRemoved
,
this
,
&
self_type
::
onTextRemoved
,
Qt
::
UniqueConnection
);
...
...
@@ -976,6 +977,20 @@ private:
}
}
void
onDocumentSaved
(
KTextEditor
::
Document
*
doc
,
bool
saveAs
)
{
if
(
!
saveAs
)
{
auto
it
=
m_docs
.
find
(
doc
);
if
(
it
!=
m_docs
.
end
()
&&
it
->
server
)
{
auto
server
=
it
->
server
;
const
auto
&
saveOptions
=
server
->
capabilities
().
textDocumentSync
.
save
;
if
(
saveOptions
)
{
server
->
didSave
(
doc
->
url
(),
saveOptions
->
includeText
?
doc
->
text
()
:
QString
());
}
}
}
}
void
onMessage
(
bool
isLog
,
const
LSPLogMessageParams
&
params
)
{
// determine server description
...
...
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