1
1
import { Api , CodeAnalysis , TypedGlobalIdentifier } from 'jitterbit-script' ;
2
- import { Hover , HoverParams , MarkedString } from 'vscode-languageserver' ;
2
+ import { Hover , HoverParams , MarkupContent , MarkupKind } from 'vscode-languageserver' ;
3
3
import { idInRange , makeRange } from '../utils/position' ;
4
4
5
5
/**
@@ -25,38 +25,30 @@ export function getHover(params: HoverParams, analysis?: CodeAnalysis): Hover |
25
25
? `(${ varType } , ${ Api . getSysVar ( id . symbol ) ?. type } ) ${ id . symbol } : ${ id . type } `
26
26
: `(${ varType } ) ${ id . symbol } : ${ id . type } ` ;
27
27
28
- const contents : MarkedString [ ] = [
29
- {
30
- language : "jitterbit" ,
31
- value : signature
32
- }
33
- ] ;
34
-
28
+ let value = `\`\`\`jitterbit\n${ signature } \n\`\`\`\n` ;
35
29
if ( varType === "system" ) {
36
30
const sysVar = Api . getSysVar ( id . symbol ) ;
37
- if ( sysVar ) {
38
- contents . push ( sysVar . description ) ;
39
- }
31
+ if ( sysVar )
32
+ value += sysVar . description ;
40
33
}
34
+ const contents = { kind : MarkupKind . Markdown , value} ;
41
35
return { contents, range : makeRange ( id . start , id . end ) } ;
42
36
}
43
37
}
44
38
45
39
// functions
40
+ const prefix = `\`\`\`jitterbit\n(function)` ;
46
41
for ( const id of analysis . callees ) {
47
42
const range = makeRange ( id . start , id . end ) ;
48
43
if ( idInRange ( params . position , range ) ) {
49
44
const func = Api . getFunc ( id . symbol ) ;
50
45
if ( ! func )
51
46
continue ;
52
- const contents : MarkedString [ ] = [ ] ;
53
- for ( let idx = 0 ; idx < func . signatures . length ; idx ++ ) {
54
- contents . push ( {
55
- language : "jitterbit" ,
56
- value : `(function) ${ func . toString ( idx ) } `
57
- } ) ;
58
- }
59
- contents . push ( func . docs ) ;
47
+ let value = "" ;
48
+ for ( let idx = 0 ; idx < func . signatures . length ; idx ++ )
49
+ value += `${ prefix } ${ func . toString ( idx ) } \n\`\`\`\n` ;
50
+ value += func . docs ;
51
+ const contents : MarkupContent = { kind : MarkupKind . Markdown , value} ;
60
52
return { contents, range : makeRange ( id . start , id . end ) } ;
61
53
}
62
54
}
0 commit comments