@@ -524,7 +524,7 @@ describe('server', () => {
524
524
525
525
const onCompletion = connection . onCompletion . mock . calls [ 0 ] [ 0 ]
526
526
527
- const result : any = await onCompletion (
527
+ const result = await onCompletion (
528
528
{
529
529
textDocument : {
530
530
uri : FIXTURE_URI . SOURCING ,
@@ -540,9 +540,6 @@ describe('server', () => {
540
540
)
541
541
542
542
// they are all variables
543
- expect ( Array . from ( new Set ( result . map ( ( item : any ) => item . kind ) ) ) ) . toEqual ( [
544
- LSP . CompletionItemKind . Variable ,
545
- ] )
546
543
expect ( result ) . toMatchInlineSnapshot ( `
547
544
Array [
548
545
Object {
@@ -603,7 +600,48 @@ describe('server', () => {
603
600
} )
604
601
605
602
describe ( 'onCompletionResolve' , ( ) => {
606
- // FIXME
603
+ it ( 'resolves documentation for buitins' , async ( ) => {
604
+ const { connection } = await initializeServer ( { rootPath : REPO_ROOT_FOLDER } )
605
+
606
+ const onCompletionResolve = connection . onCompletionResolve . mock . calls [ 0 ] [ 0 ]
607
+
608
+ const item = {
609
+ data : {
610
+ type : CompletionItemDataType . Builtin ,
611
+ } ,
612
+ kind : LSP . CompletionItemKind . Function ,
613
+ label : 'echo' ,
614
+ }
615
+ const result = await onCompletionResolve ( item , { } as any )
616
+
617
+ expect ( result ) . toEqual ( {
618
+ ...item ,
619
+ documentation : {
620
+ kind : 'markdown' ,
621
+ value : expect . stringContaining ( 'Write arguments to the standard output' ) ,
622
+ } ,
623
+ } )
624
+ } )
625
+
626
+ it ( 'ignores unknown items' , async ( ) => {
627
+ const { connection } = await initializeServer ( { rootPath : REPO_ROOT_FOLDER } )
628
+
629
+ const onCompletionResolve = connection . onCompletionResolve . mock . calls [ 0 ] [ 0 ]
630
+
631
+ const item = {
632
+ data : {
633
+ type : CompletionItemDataType . Symbol ,
634
+ } ,
635
+ kind : LSP . CompletionItemKind . Function ,
636
+ label : 'foobar' ,
637
+ }
638
+ const result = await onCompletionResolve ( item , { } as any )
639
+
640
+ expect ( result ) . toEqual ( {
641
+ ...item ,
642
+ documentation : undefined ,
643
+ } )
644
+ } )
607
645
} )
608
646
609
647
describe ( 'onDefinition' , ( ) => {
0 commit comments