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
348b3b3e
Commit
348b3b3e
authored
Feb 11, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Feb 11, 2021
Browse files
Simplify things and get rid of unnecessary stuff
parent
ca62efab
Changes
3
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclienthover.cpp
View file @
348b3b3e
...
...
@@ -27,7 +27,6 @@ class LSPClientHoverImpl : public LSPClientHover
QSharedPointer
<
LSPClientServerManager
>
m_manager
;
QSharedPointer
<
LSPClientServer
>
m_server
;
LspTooltip
m_tooltip
;
LSPClientServer
::
RequestHandle
m_handle
;
...
...
@@ -65,7 +64,7 @@ public:
// hack: delayed handling of tooltip on our own, the API is too dumb for a-sync feedback ;=)
if
(
m_server
)
{
QPointer
<
KTextEditor
::
View
>
v
(
view
);
auto
h
=
[
this
,
v
,
position
](
const
LSPHover
&
info
)
{
auto
h
=
[
v
,
position
](
const
LSPHover
&
info
)
{
if
(
!
v
||
info
.
contents
.
isEmpty
())
{
return
;
}
...
...
@@ -79,7 +78,7 @@ public:
finalTooltip
.
append
(
element
.
value
);
}
m_t
ooltip
.
show
(
finalTooltip
,
v
->
mapToGlobal
(
v
->
cursorToCoordinate
(
position
)),
v
);
LspT
ooltip
::
show
(
finalTooltip
,
v
->
mapToGlobal
(
v
->
cursorToCoordinate
(
position
)),
v
);
};
if
(
view
&&
view
->
document
())
{
...
...
addons/lspclient/lsptooltip.cpp
View file @
348b3b3e
...
...
@@ -4,17 +4,13 @@
#include <QEvent>
#include <QFontMetrics>
#include <QLabel>
#include <QLayout>
#include <QMouseEvent>
#include <QString>
#include <QStyle>
#include <QTextBrowser>
#include <QTimer>
#include <QWidget>
#include <KTextEditor/ConfigInterface>
#include <KTextEditor/Editor>
#include <KTextEditor/MainWindow>
#include <KTextEditor/View>
#include <KSyntaxHighlighting/AbstractHighlighter>
...
...
@@ -48,7 +44,7 @@ class HtmlHl : public AbstractHighlighter
{
public:
HtmlHl
()
:
out
(
&
str
out
)
:
out
(
&
out
putString
)
{
}
...
...
@@ -56,9 +52,11 @@ public:
{
text
=
txt
;
QTextStream
in
(
&
text
);
KSyntaxHighlighting
::
State
state
;
out
.
reset
();
strout
.
clear
();
outputString
.
clear
();
KSyntaxHighlighting
::
State
state
;
bool
li
=
false
;
while
(
!
in
.
atEnd
())
{
currentLine
=
in
.
readLine
();
...
...
@@ -86,11 +84,11 @@ public:
}
}
QString
html
()
QString
html
()
const
{
// while (!out.atEnd())
// qWarning() << out.readLine();
return
str
out
;
return
out
putString
;
}
protected:
...
...
@@ -99,18 +97,14 @@ protected:
if
(
!
length
)
return
;
QVarLengthArray
<
QString
,
1
>
formatOutput
;
QString
formatOutput
;
if
(
format
.
hasTextColor
(
theme
()))
{
formatOutput
<<
toHtmlRgbaString
(
format
.
textColor
(
theme
()))
<<
QStringLiteral
(
";"
)
;
formatOutput
=
toHtmlRgbaString
(
format
.
textColor
(
theme
()));
}
if
(
!
formatOutput
.
isEmpty
())
{
out
<<
"<span style=
\"
color:"
;
for
(
const
auto
&
o
:
qAsConst
(
formatOutput
))
{
out
<<
o
;
}
out
<<
"
\"
>"
;
out
<<
"<span style=
\"
color:"
<<
formatOutput
<<
"
\"
>"
;
}
out
<<
currentLine
.
mid
(
offset
,
length
).
toHtmlEscaped
();
...
...
@@ -123,7 +117,7 @@ protected:
private:
QString
text
;
QString
currentLine
;
QString
str
out
;
QString
out
putString
;
QTextStream
out
;
};
...
...
@@ -263,10 +257,6 @@ private:
KSyntaxHighlighting
::
Repository
r
;
};
LspTooltip
::
LspTooltip
()
{
}
void
LspTooltip
::
show
(
const
QString
&
text
,
QPoint
pos
,
KTextEditor
::
View
*
v
)
{
if
(
text
.
isEmpty
())
...
...
addons/lspclient/lsptooltip.h
View file @
348b3b3e
...
...
@@ -15,11 +15,7 @@ class View;
class
LspTooltip
{
public:
LspTooltip
();
void
show
(
const
QString
&
text
,
QPoint
pos
,
KTextEditor
::
View
*
v
);
private:
Tooltip
*
m_tooltip
;
static
void
show
(
const
QString
&
text
,
QPoint
pos
,
KTextEditor
::
View
*
v
);
};
#endif // LSPTOOLTIP_H
Write
Preview
Supports
Markdown
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