From 53f6354772090be9707aaf758004d499df7c2529 Mon Sep 17 00:00:00 2001 From: maziac Date: Fri, 17 Jul 2020 13:17:55 +0200 Subject: [PATCH] Fixed #40 "Hover display incorrect" --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/HoverProvider.ts | 14 +++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e88be..d4667fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# 1.5.3 +- Fixes: + - #40: "Hover display incorrect" + # 1.5.2 - Fixes: - #39: "Wrong substitution: e.label" diff --git a/package.json b/package.json index 9d1416f..7169e0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "asm-code-lens", "displayName": "ASM Code Lens", - "version": "1.5.2", + "version": "1.5.3", "publisher": "maziac", "description": "A language server that enables code lens, references, hover information, symbol renaming and the outline view for assembler files.", "author": { diff --git a/src/HoverProvider.ts b/src/HoverProvider.ts index 62620e4..0637ea6 100644 --- a/src/HoverProvider.ts +++ b/src/HoverProvider.ts @@ -59,7 +59,7 @@ export class HoverProvider implements vscode.HoverProvider { .then(reducedLocations => { // Now read the comment lines above the document. // Normally there is only one but e.g. if there are 2 modules with the same name there could be more. - const hoverTexts = new Array(); + const hoverTexts = new Array(); const f = (index: number) => { // Check for end if(index < reducedLocations.length) { @@ -72,9 +72,11 @@ export class HoverProvider implements vscode.HoverProvider { // Now find all comments above the found line const prevHoverTextArrayLength=hoverTexts.length; - const text = lines[lineNr]; + const text=lines[lineNr]; + const textMd=new vscode.MarkdownString(); + textMd.appendText(text); if(text.indexOf(';') >= 0 || text.toLowerCase().indexOf('equ') >=0) // TODO: indexOf of undefined - hoverTexts.unshift(text); + hoverTexts.unshift(textMd); let startLine = lineNr-1; while(startLine >= 0) { // Check if line starts with ";" @@ -83,14 +85,16 @@ export class HoverProvider implements vscode.HoverProvider { if(!match) break; // Add text - hoverTexts.unshift(match[1]); + const textMatch=new vscode.MarkdownString(); + textMatch.appendText(match[1]); + hoverTexts.unshift(textMatch); // Next startLine --; } // Separate several entries if(prevHoverTextArrayLength != hoverTexts.length) - hoverTexts.unshift('============'); + hoverTexts.unshift(new vscode.MarkdownString('============')); // Call next f(index+1);