From 2817d91e3fd3796103562370cb33db293493845d Mon Sep 17 00:00:00 2001 From: Arnim Rupp <46819580+ruppde@users.noreply.github.com> Date: Sat, 7 Oct 2023 00:47:33 +0200 Subject: [PATCH 1/3] Update hover.py add hover in string section fix https://github.com/avast/yari/issues/63 --- yls/hover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yls/hover.py b/yls/hover.py index 1144c22..6297a44 100644 --- a/yls/hover.py +++ b/yls/hover.py @@ -64,7 +64,7 @@ async def hover(self, params: lsp_types.TextDocumentPositionParams) -> lsp_types ) log.debug(f'[HOVER] Hover request with token "{token}" and type "{token.type}"') - if token.type == yaramod.TokenType.StringId: + if token.type == yaramod.TokenType.StringId or token.type == yaramod.TokenType.StringIdAfterNewline: return await self.hover_string(token, document, position) elif token.type == yaramod.TokenType.Id: yara_file = utils.yaramod_parse_file(document.path) From 8a0b9e7be16b2571362a84480b6f5e1341de6d7a Mon Sep 17 00:00:00 2001 From: Arnim Rupp <46819580+ruppde@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:36:18 +0200 Subject: [PATCH 2/3] Update hover.py fix pylint --- yls/hover.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yls/hover.py b/yls/hover.py index 6297a44..f8e4e1d 100644 --- a/yls/hover.py +++ b/yls/hover.py @@ -64,7 +64,9 @@ async def hover(self, params: lsp_types.TextDocumentPositionParams) -> lsp_types ) log.debug(f'[HOVER] Hover request with token "{token}" and type "{token.type}"') - if token.type == yaramod.TokenType.StringId or token.type == yaramod.TokenType.StringIdAfterNewline: + if ( + token.type in (yaramod.TokenType.StringId, yaramod.TokenType.StringIdAfterNewline) + ): return await self.hover_string(token, document, position) elif token.type == yaramod.TokenType.Id: yara_file = utils.yaramod_parse_file(document.path) From 3016e08de7d521216cecf6777d8d1a2fc1078841 Mon Sep 17 00:00:00 2001 From: Arnim Rupp <46819580+ruppde@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:08:18 +0200 Subject: [PATCH 3/3] Update hover.py --- yls/hover.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yls/hover.py b/yls/hover.py index f8e4e1d..dd9ad52 100644 --- a/yls/hover.py +++ b/yls/hover.py @@ -64,9 +64,7 @@ async def hover(self, params: lsp_types.TextDocumentPositionParams) -> lsp_types ) log.debug(f'[HOVER] Hover request with token "{token}" and type "{token.type}"') - if ( - token.type in (yaramod.TokenType.StringId, yaramod.TokenType.StringIdAfterNewline) - ): + if token.type in (yaramod.TokenType.StringId, yaramod.TokenType.StringIdAfterNewline): return await self.hover_string(token, document, position) elif token.type == yaramod.TokenType.Id: yara_file = utils.yaramod_parse_file(document.path)