Skip to content

Commit

Permalink
Fixed #40 "Hover display incorrect"
Browse files Browse the repository at this point in the history
  • Loading branch information
maziac committed Jul 17, 2020
1 parent 7cd4c1b commit 53f6354
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 1.5.3
- Fixes:
- #40: "Hover display incorrect"

# 1.5.2
- Fixes:
- #39: "Wrong substitution: e.label"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
14 changes: 9 additions & 5 deletions src/HoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>();
const hoverTexts = new Array<vscode.MarkdownString>();
const f = (index: number) => {
// Check for end
if(index < reducedLocations.length) {
Expand All @@ -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 ";"
Expand All @@ -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);
Expand Down

0 comments on commit 53f6354

Please sign in to comment.