Created
February 12, 2023 14:30
-
-
Save kfly8/3989101b80918e674d567900b3ba5c6d to your computer and use it in GitHub Desktop.
Perl Navigator server/src/hover.ts をいじって、前後の数行を表示してみる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/server/src/hover.ts b/server/src/hover.ts | |
| index e469b56..dfb7e60 100644 | |
| --- a/server/src/hover.ts | |
| +++ b/server/src/hover.ts | |
| @@ -22,6 +22,20 @@ export function getHover(params: TextDocumentPositionParams, perlDoc: PerlDocume | |
| let hoverStr = buildHoverDoc(symbol, elem); | |
| if(!hoverStr) return; // Sometimes, there's nothing worth showing. | |
| + const BEFORE_CONTEXT_COUNT = 3; | |
| + const AFTER_CONTEXT_COUNT = 3; | |
| + const context = [ | |
| + '----', | |
| + "\n", | |
| + '```perl', | |
| + txtDoc.getText({ | |
| + start: { line: elem.line - BEFORE_CONTEXT_COUNT, character: 0 }, | |
| + end: { line: elem.line + AFTER_CONTEXT_COUNT, character: 0 } | |
| + }), | |
| + '```', | |
| + ].join("\n"); | |
| + hoverStr += "\n" + context; | |
| + | |
| const documentation = {contents: hoverStr}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment