diff --git a/tests/cases/fourslash/docCommentScaffoldingEmptyFile.ts b/tests/cases/fourslash/docCommentScaffoldingEmptyFile.ts index 0d8cb1f28de..733c7673579 100644 --- a/tests/cases/fourslash/docCommentScaffoldingEmptyFile.ts +++ b/tests/cases/fourslash/docCommentScaffoldingEmptyFile.ts @@ -3,4 +3,4 @@ // @Filename: emptyFile.ts /////*0*/ -verify.DocCommentScaffolding(0, { newText: "/** */", cursorOffset: 3}); \ No newline at end of file +verify.DocCommentScaffolding("/** */", 3); \ No newline at end of file diff --git a/tests/cases/fourslash/docCommentScaffoldingFunctionWithParameters.ts b/tests/cases/fourslash/docCommentScaffoldingFunctionWithParameters.ts new file mode 100644 index 00000000000..11eb8495fe7 --- /dev/null +++ b/tests/cases/fourslash/docCommentScaffoldingFunctionWithParameters.ts @@ -0,0 +1,11 @@ +/// + +// @Filename: emptyFile.ts +/////*0*/ +//// /*1*/ +//// function foo(x: number, y: string): boolean {} + +const noIndentEmptyScaffolding = "/**\n * \n * @param x \n * @param y\n */"; +const oneIndentEmptyScaffolding = "/**\n * \n * @param x \n * @param y\n */"; +const noIndentOffset = 7; +const oneIndentOffset = noIndentOffset + 4; \ No newline at end of file diff --git a/tests/cases/fourslash/docCommentScaffoldingInMultiLineComment.ts b/tests/cases/fourslash/docCommentScaffoldingInMultiLineComment.ts new file mode 100644 index 00000000000..7055cc376cd --- /dev/null +++ b/tests/cases/fourslash/docCommentScaffoldingInMultiLineComment.ts @@ -0,0 +1,6 @@ +/// + +// @Filename: emptyFile.ts +//// /* /*0*/ */ +goTo.marker("0"); +verify.DocCommentScaffolding("/**", 3); \ No newline at end of file diff --git a/tests/cases/fourslash/docCommentScaffoldingInSingleLineComment.ts b/tests/cases/fourslash/docCommentScaffoldingInSingleLineComment.ts new file mode 100644 index 00000000000..2c8e7afc397 --- /dev/null +++ b/tests/cases/fourslash/docCommentScaffoldingInSingleLineComment.ts @@ -0,0 +1,22 @@ +/// + +// @Filename: emptyFile.ts +//// // We want to check off-by-one errors in assessing the end of the comment, so we check twice, +//// // first with a trailing space and then without. +//// // /*0*/ +//// // /*1*/ +/////*2*/ +//// // We also want to check EOF handling at the end of a comment +//// // /*3*/ + +goTo.marker("0"); +verify.DocCommentScaffolding("/**", 3); + +goTo.marker("1"); +verify.DocCommentScaffolding("/**", 3); + +goTo.marker("2"); +verify.DocCommentScaffolding("/** */", 3); + +goTo.marker("3"); +verify.DocCommentScaffolding("/**", 3); \ No newline at end of file diff --git a/tests/cases/fourslash/docCommentScaffoldingIndentation.ts b/tests/cases/fourslash/docCommentScaffoldingIndentation.ts new file mode 100644 index 00000000000..77031ad14e1 --- /dev/null +++ b/tests/cases/fourslash/docCommentScaffoldingIndentation.ts @@ -0,0 +1,22 @@ +/// + +// @Filename: emptyFile.ts +/////*0*/ +//// /*1*/ +//// /*2*/function /*3*/foo/*4*/(/*5*/) /*6*/{ /*7*/}/*8*/ + +const noIndentEmptyScaffolding = "/**\n * \n */"; +const oneIndentEmptyScaffolding = "/**\n * \n */"; +const twoIndentEmptyScaffolding = "/**\n * \n */"; +const noIndentOffset = 7; +const oneIndentOffset = noIndentOffset + 4; +const twoIndentOffset = oneIndentOffset + 4; + +goTo.marker("0"); +verify.DocCommentScaffolding(noIndentEmptyScaffolding, noIndentOffset); + +goTo.marker("1"); +verify.DocCommentScaffolding(oneIndentEmptyScaffolding, oneIndentOffset); + +goTo.marker("2"); +verify.DocCommentScaffolding(twoIndentEmptyScaffolding, twoIndentOffset); \ No newline at end of file diff --git a/tests/cases/fourslash/docCommentScaffoldingInsideFunctionDeclaration.ts b/tests/cases/fourslash/docCommentScaffoldingInsideFunctionDeclaration.ts new file mode 100644 index 00000000000..dd154042dab --- /dev/null +++ b/tests/cases/fourslash/docCommentScaffoldingInsideFunctionDeclaration.ts @@ -0,0 +1,25 @@ +/// + +// @Filename: emptyFile.ts +////function /*0*/foo/*1*/(/*2*/) /*3*/{ /*4*/}/*5*/ + +const emptyCompletion = "/** */"; +const emptyIndent = 3; + +goTo.marker("0"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent); + +goTo.marker("1"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent); + +goTo.marker("2"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent); + +goTo.marker("3"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent); + +goTo.marker("4"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent); + +goTo.marker("5"); +verify.DocCommentScaffolding(emptyCompletion, emptyIndent);