@@ -106,6 +106,7 @@ function getMappedVSCodeSymbol(pythonType: string): vscode.SymbolKind {
106106export enum CommandType {
107107 Arguments ,
108108 Completions ,
109+ Hover ,
109110 Usages ,
110111 Definitions ,
111112 Symbols
@@ -115,6 +116,7 @@ var commandNames = new Map<CommandType, string>();
115116commandNames . set ( CommandType . Arguments , "arguments" ) ;
116117commandNames . set ( CommandType . Completions , "completions" ) ;
117118commandNames . set ( CommandType . Definitions , "definitions" ) ;
119+ commandNames . set ( CommandType . Hover , "tooltip" ) ;
118120commandNames . set ( CommandType . Usages , "usages" ) ;
119121commandNames . set ( CommandType . Symbols , "names" ) ;
120122
@@ -291,7 +293,7 @@ function spawnProcess(dir: string) {
291293 const originalType = < string > < any > item . type ;
292294 item . type = getMappedVSCodeType ( originalType ) ;
293295 item . kind = getMappedVSCodeSymbol ( originalType ) ;
294- item . raw_type = getMappedVSCodeType ( originalType ) ;
296+ item . rawType = getMappedVSCodeType ( originalType ) ;
295297 } ) ;
296298
297299 let completionResult : ICompletionResult = {
@@ -313,6 +315,7 @@ function spawnProcess(dir: string) {
313315 defResult . definition = {
314316 fileName : def . fileName ,
315317 text : def . text ,
318+ rawType : originalType ,
316319 type : getMappedVSCodeType ( originalType ) ,
317320 kind : getMappedVSCodeSymbol ( originalType ) ,
318321 container : def . container ,
@@ -328,6 +331,22 @@ function spawnProcess(dir: string) {
328331 cmd . deferred . resolve ( defResult ) ;
329332 break ;
330333 }
334+ case CommandType . Hover : {
335+ var defs = < any [ ] > response [ 'results' ] ;
336+ var defResult : IHoverResult = {
337+ requestId : cmd . id ,
338+ items : defs . map ( def => {
339+ return {
340+ kind : getMappedVSCodeSymbol ( def . type ) ,
341+ description : def . description ,
342+ signature : def . signature
343+ }
344+ } )
345+ } ;
346+
347+ cmd . deferred . resolve ( defResult ) ;
348+ break ;
349+ }
331350 case CommandType . Symbols : {
332351 var defs = < any [ ] > response [ 'results' ] ;
333352 defs = Array . isArray ( defs ) ? defs : [ ] ;
@@ -340,6 +359,7 @@ function spawnProcess(dir: string) {
340359 return {
341360 fileName : def . fileName ,
342361 text : def . text ,
362+ rawType : originalType ,
343363 type : getMappedVSCodeType ( originalType ) ,
344364 kind : getMappedVSCodeSymbol ( originalType ) ,
345365 container : def . container ,
@@ -563,6 +583,9 @@ export interface ICommandResult {
563583export interface ICompletionResult extends ICommandResult {
564584 items : IAutoCompleteItem [ ] ;
565585}
586+ export interface IHoverResult extends ICommandResult {
587+ items : IHoverItem [ ] ;
588+ }
566589export interface IDefinitionResult extends ICommandResult {
567590 definition : IDefinition ;
568591}
@@ -600,7 +623,7 @@ export interface IReference {
600623
601624export interface IAutoCompleteItem {
602625 type : vscode . CompletionItemKind ;
603- raw_type : vscode . CompletionItemKind ;
626+ rawType : vscode . CompletionItemKind ;
604627 kind : vscode . SymbolKind ;
605628 text : string ;
606629 description : string ;
@@ -614,6 +637,7 @@ interface IDefinitionRange {
614637 endColumn : number ;
615638}
616639export interface IDefinition {
640+ rawType : string ;
617641 type : vscode . CompletionItemKind ;
618642 kind : vscode . SymbolKind ;
619643 text : string ;
@@ -622,7 +646,13 @@ export interface IDefinition {
622646 range : IDefinitionRange ;
623647}
624648
625- export class JediProxyHandler < R extends ICommandResult , T > {
649+ export interface IHoverItem {
650+ kind : vscode . SymbolKind ;
651+ description : string ;
652+ signature : string ;
653+ }
654+
655+ export class JediProxyHandler < R extends ICommandResult > {
626656 private jediProxy : JediProxy ;
627657 private lastToken : vscode . CancellationToken ;
628658 private lastCommandId : number ;
0 commit comments