diff --git a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/codeaction/providers/docs/AddDocumentationCodeAction.java b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/codeaction/providers/docs/AddDocumentationCodeAction.java index e1da04d15006..f7056d1d5996 100644 --- a/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/codeaction/providers/docs/AddDocumentationCodeAction.java +++ b/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/codeaction/providers/docs/AddDocumentationCodeAction.java @@ -85,7 +85,13 @@ public List getSyntaxKinds() { SyntaxKind.READONLY_TYPE_DESC, SyntaxKind.FUTURE_TYPE_DESC, SyntaxKind.SINGLETON_TYPE_DESC, - SyntaxKind.INTERSECTION_TYPE_DESC + SyntaxKind.INTERSECTION_TYPE_DESC, + SyntaxKind.QUALIFIED_NAME_REFERENCE, + SyntaxKind.SIMPLE_NAME_REFERENCE, + SyntaxKind.TYPEDESC_TYPE_DESC, + SyntaxKind.DISTINCT_TYPE_DESC, + SyntaxKind.OPTIONAL_TYPE_DESC, + SyntaxKind.PARENTHESISED_TYPE_DESC ); } diff --git a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AddDocumentationTest.java b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AddDocumentationTest.java index f4b1c4bb0c46..437363689374 100644 --- a/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AddDocumentationTest.java +++ b/language-server/modules/langserver-core/src/test/java/org/ballerinalang/langserver/codeaction/AddDocumentationTest.java @@ -75,6 +75,15 @@ public Object[][] dataProvider() { {"singleDocGeneration17.json"}, {"singleDocGeneration18.json"}, {"singleDocGeneration19.json"}, + {"singleDocGeneration20.json"}, + {"singleDocGeneration21.json"}, + {"singleDocGeneration22.json"}, + {"singleDocGeneration23.json"}, + {"singleDocGeneration24.json"}, + {"singleDocGeneration25.json"}, + {"singleDocGeneration26.json"}, + {"singleDocGeneration27.json"}, + {"singleDocGeneration28.json"}, }; } diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration20.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration20.json new file mode 100644 index 000000000000..fe3fff1379d1 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration20.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 112, + "character": 11 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 112, + "character": 0 + }, + "end": { + "line": 112, + "character": 18 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration21.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration21.json new file mode 100644 index 000000000000..c1bbcd4f4a24 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration21.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 114, + "character": 17 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 114, + "character": 0 + }, + "end": { + "line": 114, + "character": 30 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration22.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration22.json new file mode 100644 index 000000000000..bb8b5273d20b --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration22.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 115, + "character": 17 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 115, + "character": 0 + }, + "end": { + "line": 115, + "character": 30 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration23.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration23.json new file mode 100644 index 000000000000..1dcbeddb3624 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration23.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 116, + "character": 14 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 116, + "character": 0 + }, + "end": { + "line": 116, + "character": 24 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration24.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration24.json new file mode 100644 index 000000000000..fcba5fd09930 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration24.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 117, + "character": 31 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 117, + "character": 0 + }, + "end": { + "line": 117, + "character": 58 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration25.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration25.json new file mode 100644 index 000000000000..1c9d95f8dbed --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration25.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 119, + "character": 15 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 119, + "character": 0 + }, + "end": { + "line": 119, + "character": 30 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration26.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration26.json new file mode 100644 index 000000000000..bcc88970dab5 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration26.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 121, + "character": 20 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 121, + "character": 0 + }, + "end": { + "line": 121, + "character": 36 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration27.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration27.json new file mode 100644 index 000000000000..0a51d389d194 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration27.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 123, + "character": 18 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 123, + "character": 0 + }, + "end": { + "line": 123, + "character": 24 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration28.json b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration28.json new file mode 100644 index 000000000000..33ea00c66431 --- /dev/null +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/config/singleDocGeneration28.json @@ -0,0 +1,32 @@ +{ + "position": { + "line": 124, + "character": 11 + }, + "source": "singleDocGeneration.bal", + "expected": [ + { + "title": "Document this", + "command": { + "title": "Document this", + "command": "ADD_DOC", + "arguments": [ + { + "key": "node.range", + "value": { + "start": { + "line": 124, + "character": 0 + }, + "end": { + "line": 124, + "character": 18 + } + } + } + ] + }, + "resolvable": false + } + ] +} diff --git a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/source/singleDocGeneration.bal b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/source/singleDocGeneration.bal index 4387ea4ad1c6..f23f9833a112 100644 --- a/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/source/singleDocGeneration.bal +++ b/language-server/modules/langserver-core/src/test/resources/codeaction/add-documentation/source/singleDocGeneration.bal @@ -108,3 +108,18 @@ type IntArray int[]; type Pi 3.14285714286d; type ReadonlyInt readonly & int; + +type MyInt 12; +type MyInt2 MyInt; + +type MyXMLComment xml:Comment; +type MyXMLElement xml:Element; +type MyXMLText xml:Text; +type MyXMLProcessingInstruction xml:ProcessingInstruction; + +type MyTypeDesc typedesc; + +type MyDistinctError distinct error; + +type MyOptionalInt int?; +type MyInt3 (int);