-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41053 from LakshanWeerasinghe/fix-#40294
Fix fill record field code action and fill record filed completions
- Loading branch information
Showing
16 changed files
with
443 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/codeaction/fill-record-fields/config/fill_record_fields_config19.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"position": { | ||
"line": 16, | ||
"character": 27 | ||
}, | ||
"source": "fill_record_fields_source16.bal", | ||
"description": "Fill record fields in object field", | ||
"expected": [ | ||
{ | ||
"title": "Fill 'Foo' required fields", | ||
"kind": "quickfix", | ||
"edits": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 16, | ||
"character": 27 | ||
}, | ||
"end": { | ||
"line": 16, | ||
"character": 27 | ||
} | ||
}, | ||
"newText": ",id: 0" | ||
} | ||
], | ||
"resolvable": false | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/codeaction/fill-record-fields/config/fill_record_fields_config20.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"position": { | ||
"line": 18, | ||
"character": 27 | ||
}, | ||
"source": "fill_record_fields_source16.bal", | ||
"description": "Fill record fields in object field", | ||
"expected": [ | ||
{ | ||
"title": "Fill 'Bar' required fields", | ||
"kind": "quickfix", | ||
"edits": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 18, | ||
"character": 27 | ||
}, | ||
"end": { | ||
"line": 18, | ||
"character": 27 | ||
} | ||
}, | ||
"newText": ",id: 0" | ||
} | ||
], | ||
"resolvable": false | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/codeaction/fill-record-fields/config/fill_record_fields_config21.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"position": { | ||
"line": 20, | ||
"character": 27 | ||
}, | ||
"source": "fill_record_fields_source16.bal", | ||
"description": "Fill record fields in object field", | ||
"expected": [ | ||
{ | ||
"title": "Fill 'Baz' required fields", | ||
"kind": "quickfix", | ||
"edits": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 20, | ||
"character": 27 | ||
}, | ||
"end": { | ||
"line": 20, | ||
"character": 27 | ||
} | ||
}, | ||
"newText": ",id: 0" | ||
} | ||
], | ||
"resolvable": false | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/codeaction/fill-record-fields/config/fill_record_fields_config22.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"position": { | ||
"line": 22, | ||
"character": 46 | ||
}, | ||
"source": "fill_record_fields_source16.bal", | ||
"description": "Fill record fields in object field", | ||
"expected": [ | ||
{ | ||
"title": "Fill 'record {|readonly string 'type; readonly int id; anydata & readonly...;|}' required fields", | ||
"kind": "quickfix", | ||
"edits": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 22, | ||
"character": 46 | ||
}, | ||
"end": { | ||
"line": 22, | ||
"character": 46 | ||
} | ||
}, | ||
"newText": ",id: 0" | ||
} | ||
], | ||
"resolvable": false | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/codeaction/fill-record-fields/config/fill_record_fields_config23.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"position": { | ||
"line": 27, | ||
"character": 45 | ||
}, | ||
"source": "fill_record_fields_source16.bal", | ||
"description": "Fill record fields in object field", | ||
"expected": [ | ||
{ | ||
"title": "Fill 'record {|readonly string 'type; readonly int id; anydata & readonly...;|}' required fields", | ||
"kind": "quickfix", | ||
"edits": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 27, | ||
"character": 45 | ||
}, | ||
"end": { | ||
"line": 27, | ||
"character": 45 | ||
} | ||
}, | ||
"newText": ",id: 0" | ||
} | ||
], | ||
"resolvable": false | ||
} | ||
] | ||
} |
29 changes: 29 additions & 0 deletions
29
...e/src/test/resources/codeaction/fill-record-fields/source/fill_record_fields_source16.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
type Foo record { | ||
string 'type; | ||
int id; | ||
}; | ||
|
||
type Bar readonly & record { | ||
string 'type; | ||
int id; | ||
}; | ||
|
||
type Baz record { | ||
readonly string 'type; | ||
int id; | ||
}; | ||
|
||
function testFillRecordFields() { | ||
Foo foo = {'type: "foo"}; | ||
|
||
Bar bar = {'type: "bar"}; | ||
|
||
Baz baz = {'type: "baz"}; | ||
|
||
Foo & readonly fooReadonly = {'type: "foo"}; | ||
|
||
record { | ||
string 'type; | ||
int id; | ||
} & readonly fooReadonly2 = {'type: "foo"}; | ||
} |
36 changes: 36 additions & 0 deletions
36
...resources/completion/expression_context/config/mapping_constructor_expr_ctx_config10.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"position": { | ||
"line": 20, | ||
"character": 28 | ||
}, | ||
"source": "expression_context/source/mapping_constructor_expr_ctx_source8.bal", | ||
"description": "", | ||
"items": [ | ||
{ | ||
"label": "readonly", | ||
"kind": "Keyword", | ||
"detail": "Keyword", | ||
"sortText": "U", | ||
"filterText": "readonly", | ||
"insertText": "readonly ", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "Fill Bar Required Fields", | ||
"kind": "Property", | ||
"detail": "Bar", | ||
"sortText": "R", | ||
"filterText": "fill", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "id", | ||
"kind": "Field", | ||
"detail": "Bar.id", | ||
"sortText": "K", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
} | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
...resources/completion/expression_context/config/mapping_constructor_expr_ctx_config11.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"position": { | ||
"line": 22, | ||
"character": 28 | ||
}, | ||
"source": "expression_context/source/mapping_constructor_expr_ctx_source8.bal", | ||
"description": "", | ||
"items": [ | ||
{ | ||
"label": "readonly", | ||
"kind": "Keyword", | ||
"detail": "Keyword", | ||
"sortText": "U", | ||
"filterText": "readonly", | ||
"insertText": "readonly ", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "Fill Baz Required Fields", | ||
"kind": "Property", | ||
"detail": "Baz", | ||
"sortText": "R", | ||
"filterText": "fill", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "id", | ||
"kind": "Field", | ||
"detail": "Baz.id", | ||
"sortText": "K", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
} | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
...resources/completion/expression_context/config/mapping_constructor_expr_ctx_config12.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"position": { | ||
"line": 24, | ||
"character": 47 | ||
}, | ||
"source": "expression_context/source/mapping_constructor_expr_ctx_source8.bal", | ||
"description": "", | ||
"items": [ | ||
{ | ||
"label": "readonly", | ||
"kind": "Keyword", | ||
"detail": "Keyword", | ||
"sortText": "U", | ||
"filterText": "readonly", | ||
"insertText": "readonly ", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "Fill record {|readonly string 'type; readonly int id; anydata & readonly...;|} Required Fields", | ||
"kind": "Property", | ||
"detail": "record {|readonly string 'type; readonly int id; anydata & readonly...;|}", | ||
"sortText": "R", | ||
"filterText": "fill", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "id", | ||
"kind": "Field", | ||
"detail": "(record {|readonly string 'type; readonly int id; anydata & readonly...;|}).id", | ||
"sortText": "K", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
} | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
...resources/completion/expression_context/config/mapping_constructor_expr_ctx_config13.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"position": { | ||
"line": 29, | ||
"character": 46 | ||
}, | ||
"source": "expression_context/source/mapping_constructor_expr_ctx_source8.bal", | ||
"description": "", | ||
"items": [ | ||
{ | ||
"label": "readonly", | ||
"kind": "Keyword", | ||
"detail": "Keyword", | ||
"sortText": "U", | ||
"filterText": "readonly", | ||
"insertText": "readonly ", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "Fill record {|readonly string 'type; readonly int id; anydata & readonly...;|} Required Fields", | ||
"kind": "Property", | ||
"detail": "record {|readonly string 'type; readonly int id; anydata & readonly...;|}", | ||
"sortText": "R", | ||
"filterText": "fill", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
}, | ||
{ | ||
"label": "id", | ||
"kind": "Field", | ||
"detail": "(record {|readonly string 'type; readonly int id; anydata & readonly...;|}).id", | ||
"sortText": "K", | ||
"insertText": "id: ${1:0}", | ||
"insertTextFormat": "Snippet" | ||
} | ||
] | ||
} |
Oops, something went wrong.