Skip to content

Commit ae54648

Browse files
committed
Fixed issue with hover Provider returning invalid
1 parent 76c2cf0 commit ae54648

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The following enhancements and changes have been made to Atari Dev Studio:
55
## 0.5.8
66

77
* Repackage to attempt fixing missing find-process package on macOS (Andrew Davie)
8+
* Fixed issue where hover provider returned invalid content result (throwing unncessary errors in the developer logs)
89

910
## 0.5.7
1011

out/hovers/hoverBase.js

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/hovers/hoverBase.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hovers/hoverBase.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ export abstract class HoverBase implements vscode.HoverProvider {
7171

7272
}
7373

74-
provideHover(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): vscode.ProviderResult<vscode.Hover> {
74+
provideHover(document: vscode.TextDocument, position: vscode.Position): vscode.ProviderResult<vscode.Hover> {
75+
// Prepare
7576
const validchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
7677
let word='';
7778
let p = position.character;
@@ -81,9 +82,17 @@ export abstract class HoverBase implements vscode.HoverProvider {
8182
while (p > 0 && validchars.indexOf(line[p]) !== -1) { p--; }
8283
// Skip leading invalid character
8384
if (validchars.indexOf(line[p]) === -1) { p++; }
84-
// Collect string until an invalid charecter is encountered
85+
// Collect string until an invalid character is encountered
8586
while (p < line.length && validchars.indexOf(line[p]) !== -1) { word += line[p++]; }
8687

87-
return new vscode.Hover(this.hoverText[word.toUpperCase()]);
88+
// Found something to check for?
89+
if (word) {
90+
// Search and validate
91+
let content = this.hoverText[word.toUpperCase()];
92+
if (content) { return new vscode.Hover(content); }
93+
}
94+
95+
// Return
96+
return undefined;
8897
}
89-
}
98+
}

0 commit comments

Comments
 (0)