Skip to content

Commit

Permalink
Make renderTooltip render code part too
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémy Flusin committed Nov 27, 2019
1 parent 3d3ee83 commit 6a6b24e
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dist/main/atom-ide/datatipProvider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/atom-ide/datatipProvider.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/main/atom/tooltips/tooltipRenderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/atom/tooltips/tooltipRenderer.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions dist/main/atom/tooltips/tooltipView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/atom/tooltips/tooltipView.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/main/atom-ide/datatipProvider.tsx
Expand Up @@ -48,7 +48,7 @@ export class TSDatatipProvider implements DatatipProvider {
})
const data = result.body!
const code = await highlightCode(data.displayString.replace(/^\(.+?\)\s+/, ""))
const [kind, docs] = renderTooltip(data, etch)
const [, kind, docs] = renderTooltip(data, etch)
return {
component: () => (
<div className="atom-typescript-datatip-tooltip">
Expand Down
8 changes: 7 additions & 1 deletion lib/main/atom/tooltips/tooltipRenderer.tsx
@@ -1,4 +1,10 @@
export function renderTooltip(data: protocol.QuickInfoResponseBody, etch: any) {
const code = (
<div className="atom-typescript-tooltip-tooltip-code">
{data.displayString.replace(/^\(.+?\)\s+/, "")}
</div>
)

const kind = (
<div className="atom-typescript-datatip-tooltip-kind">
{data.kind}
Expand All @@ -25,7 +31,7 @@ export function renderTooltip(data: protocol.QuickInfoResponseBody, etch: any) {
</div>
)

return [kind, docs]
return [code, kind, docs]
}

function formatTagText(etch: any, tagText?: string) {
Expand Down
10 changes: 1 addition & 9 deletions lib/main/atom/tooltips/tooltipView.tsx
Expand Up @@ -43,18 +43,10 @@ export class TooltipView implements JSX.ElementClass {
}

public render() {
const code = this.props.info ? (
<div className="atom-typescript-tooltip-tooltip-code">
{this.props.info.displayString.replace(/^\(.+?\)\s+/, "")}
</div>
) : null
const [kind, docs] = this.props.info ? renderTooltip(this.props.info, etch) : [null, null]
return (
<div className="atom-typescript-tooltip tooltip">
<div className="tooltip-inner">
{code}
{kind}
{docs}
{this.props.info ? renderTooltip(this.props.info, etch) : null}
</div>
</div>
)
Expand Down

0 comments on commit 6a6b24e

Please sign in to comment.