1010 */
1111package ts .eclipse .ide .ui .hover ;
1212
13+ import org .eclipse .core .resources .IFile ;
14+ import org .eclipse .jface .text .IDocument ;
1315import org .eclipse .jface .text .ITextViewer ;
1416import org .eclipse .jface .text .Position ;
1517import org .eclipse .jface .text .contentassist .ICompletionProposal ;
1618import org .eclipse .jface .text .source .Annotation ;
1719
20+ import ts .client .CommandNames ;
21+ import ts .client .codefixes .ITypeScriptGetCodeFixesCollector ;
22+ import ts .eclipse .ide .core .resources .IIDETypeScriptProject ;
23+ import ts .eclipse .ide .core .utils .TypeScriptResourceUtil ;
24+ import ts .resources .ITypeScriptFile ;
25+
1826/**
1927 * Problem Hover used to display errors when mouse over a JS content which have
2028 * a tern error.
@@ -29,6 +37,26 @@ protected static class ProblemInfo extends AnnotationInfo {
2937 public ProblemInfo (Annotation annotation , Position position , ITextViewer textViewer ) {
3038 super (annotation , position , textViewer );
3139 }
40+
41+ @ Override
42+ public ICompletionProposal [] getCompletionProposals () {
43+ IDocument document = viewer .getDocument ();
44+ IFile file = TypeScriptResourceUtil .getFile (document );
45+ try {
46+ IIDETypeScriptProject tsProject = TypeScriptResourceUtil .getTypeScriptProject (file .getProject ());
47+ if (tsProject .canSupport (CommandNames .GetCodeFixes )) {
48+ // Get code fixes with TypeScript 2.1.1
49+ ITypeScriptFile tsFile = tsProject .openFile (file , document );
50+ tsFile .getCodeFixes (position .getOffset (), position .getOffset () + position .getLength (),
51+ new ITypeScriptGetCodeFixesCollector () {
52+ });
53+ }
54+ } catch (Exception e ) {
55+ e .printStackTrace ();
56+ }
57+ return NO_PROPOSALS ;
58+ }
59+
3260 }
3361
3462 public ProblemTypeScriptHover () {
0 commit comments