Skip to content

Commit 27bbad0

Browse files
committed
fix hover bug
1 parent e86c00d commit 27bbad0

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "XML Layout for Flutter",
44
"description": "XML Layout for Flutter. Brings Angular's style to Flutter!",
55
"publisher": "WaseemDev",
6-
"version": "0.0.16",
6+
"version": "0.0.17",
77
"icon": "images/logo.png",
88
"repository": {
99
"type": "github",
@@ -37,9 +37,6 @@
3737
}
3838
]
3939
},
40-
"extensionDependencies": [
41-
"Dart-Code.dart-code"
42-
],
4340
"scripts": {
4441
"vscode:prepublish": "webpack --mode production",
4542
"compile-prod": "webpack --mode production",

src/language-features/providers/dart_hover_provider.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ export class DartHoverProvider implements HoverProvider {
1717
return;
1818
}
1919

20-
let results: Hover[] = await commands.executeCommand('vscode.executeHoverProvider', dartDocument.uri, dartDocument.positionAt(dartOffset));
21-
results.forEach(a => a.range = null);
22-
return results[0];
20+
const results: Hover[] = await commands.executeCommand('vscode.executeHoverProvider', dartDocument.uri, dartDocument.positionAt(dartOffset));
21+
const contents: any[] = results && results[0] && results[0].contents;
22+
if (!contents) {
23+
return undefined;
24+
}
25+
// fixes bug that prevents the hover from showing
26+
const hover = new Hover([
27+
// { language: 'dart', value: (data.contents[0] as any).value },
28+
(typeof contents[0] !== 'string' ? contents[0] && (contents[0] as any).value : contents[0]) || undefined,
29+
(typeof contents[1] !== 'string' ? contents[1] && (contents[1] as any).value : contents[1]) || undefined
30+
]);
31+
return hover;
2332
} catch (e) {
2433
console.error(e);
2534
}

0 commit comments

Comments
 (0)