@@ -182,6 +182,25 @@ let f (x : t) = x
182182 "kind": "type-annotate",
183183 "title": "Type-annotate",
184184 },
185+ Object {
186+ "command": Object {
187+ "arguments": Array [
188+ "file:///test.mli",
189+ ],
190+ "command": "ocamllsp/open-related-source",
191+ "title": "Create test.mli",
192+ },
193+ "edit": Object {
194+ "documentChanges": Array [
195+ Object {
196+ "kind": "create",
197+ "uri": "file:///test.mli",
198+ },
199+ ],
200+ },
201+ "kind": "switch",
202+ "title": "Create test.mli",
203+ },
185204 ]
186205 ` ) ;
187206 } ) ;
@@ -464,7 +483,29 @@ type x =
464483 let start = Types . Position . create ( 2 , 5 ) ;
465484 let end = Types . Position . create ( 2 , 6 ) ;
466485 let actions = await codeAction ( "file:///test.ml" , start , end ) ;
467- expect ( actions ) . toBeNull ( ) ;
486+ expect ( actions ) . toMatchInlineSnapshot ( `
487+ Array [
488+ Object {
489+ "command": Object {
490+ "arguments": Array [
491+ "file:///test.mli",
492+ ],
493+ "command": "ocamllsp/open-related-source",
494+ "title": "Create test.mli",
495+ },
496+ "edit": Object {
497+ "documentChanges": Array [
498+ Object {
499+ "kind": "create",
500+ "uri": "file:///test.mli",
501+ },
502+ ],
503+ },
504+ "kind": "switch",
505+ "title": "Create test.mli",
506+ },
507+ ]
508+ ` ) ;
468509 } ) ;
469510
470511 it ( "offers `Construct an expression` code action" , async ( ) => {
@@ -480,7 +521,67 @@ let x = _
480521 ( await codeAction ( uri , Position . create ( 0 , 8 ) , Position . create ( 0 , 9 ) ) ) ??
481522 [ ] ;
482523
483- expect ( actions ) . not . toBeNull ( ) ;
524+ expect ( actions ) . toMatchInlineSnapshot ( `
525+ Array [
526+ Object {
527+ "edit": Object {
528+ "documentChanges": Array [
529+ Object {
530+ "edits": Array [
531+ Object {
532+ "newText": "(_ : 'a)",
533+ "range": Object {
534+ "end": Object {
535+ "character": 9,
536+ "line": 0,
537+ },
538+ "start": Object {
539+ "character": 8,
540+ "line": 0,
541+ },
542+ },
543+ },
544+ ],
545+ "textDocument": Object {
546+ "uri": "file:///test.ml",
547+ "version": 0,
548+ },
549+ },
550+ ],
551+ },
552+ "isPreferred": false,
553+ "kind": "type-annotate",
554+ "title": "Type-annotate",
555+ },
556+ Object {
557+ "command": Object {
558+ "command": "editor.action.triggerSuggest",
559+ "title": "Trigger Suggest",
560+ },
561+ "kind": "construct",
562+ "title": "Construct an expression",
563+ },
564+ Object {
565+ "command": Object {
566+ "arguments": Array [
567+ "file:///test.mli",
568+ ],
569+ "command": "ocamllsp/open-related-source",
570+ "title": "Create test.mli",
571+ },
572+ "edit": Object {
573+ "documentChanges": Array [
574+ Object {
575+ "kind": "create",
576+ "uri": "file:///test.mli",
577+ },
578+ ],
579+ },
580+ "kind": "switch",
581+ "title": "Create test.mli",
582+ },
583+ ]
584+ ` ) ;
484585
485586 let construct_actions = actions . find (
486587 ( codeAction : Types . CodeAction ) =>
0 commit comments