@@ -936,11 +936,16 @@ describe "JSDoc grammar", ->
936936 expect (tokens[7 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
937937 expect (tokens[9 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
938938
939- {tokens } = grammar .tokenizeLine (' /** @param {\n number\n } variable this is the description */' )
940- expect (tokens[5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
941- expect (tokens[6 ]).toEqual value : ' \n number\n ' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
942- expect (tokens[7 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
943- expect (tokens[9 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
939+ lines = grammar .tokenizeLines ("""
940+ /** @param {
941+ number
942+ } variable this is the description */
943+ """ )
944+ expect (lines[0 ][5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
945+ expect (lines[1 ][0 ].value ).toMatch (/ number/ )
946+ expect (lines[1 ][0 ].scopes ).toEqual [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
947+ expect (lines[2 ][1 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
948+ expect (lines[2 ][3 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
944949
945950 {tokens } = grammar .tokenizeLine (' /** @param {{number}} variable this is the description */' )
946951 expect (tokens[5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
@@ -950,21 +955,32 @@ describe "JSDoc grammar", ->
950955 expect (tokens[9 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
951956 expect (tokens[11 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
952957
953- {tokens } = grammar .tokenizeLine (' /** @param {{\n * number\n * }} variable this is the description */' )
954- expect (tokens[5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
955- expect (tokens[6 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
956- expect (tokens[8 ]).toEqual value : ' *' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' comment.block.documentation.jsdoc' ]
957- expect (tokens[9 ]).toEqual value : ' number\n ' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
958- expect (tokens[10 ]).toEqual value : ' *' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' comment.block.documentation.jsdoc' ]
959- expect (tokens[12 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
960- expect (tokens[13 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
961- expect (tokens[15 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
962-
963- {tokens } = grammar .tokenizeLine (' /** @param {{\n */ foo' )
964- expect (tokens[5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
965- expect (tokens[6 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
966- expect (tokens[8 ]).toEqual value : ' */' , scopes : [' source.js' , ' comment.block.documentation.js' , ' punctuation.section.end.comment.js' ]
967- expect (tokens[9 ]).toEqual value : ' foo' , scopes : [' source.js' ]
958+ lines = grammar .tokenizeLines ("""
959+ /**
960+ * @param {{
961+ * number
962+ * }} variable this is the description
963+ */
964+ """ )
965+ expect (lines[1 ][4 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
966+ expect (lines[1 ][5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
967+ expect (lines[2 ][0 ]).toEqual value : ' *' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' comment.block.documentation.jsdoc' ]
968+ expect (lines[2 ][1 ].value ).toMatch (/ number/ )
969+ expect (lines[2 ][1 ].scopes ).toEqual [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
970+ expect (lines[3 ][0 ]).toEqual value : ' *' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' comment.block.documentation.jsdoc' ]
971+ expect (lines[3 ][2 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
972+ expect (lines[3 ][3 ]).toEqual value : ' }' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.end.jsdoc' ]
973+ expect (lines[3 ][5 ]).toEqual value : ' variable' , scopes : [' source.js' , ' comment.block.documentation.js' , ' variable.other.jsdoc' ]
974+
975+ lines = grammar .tokenizeLines ("""
976+ /** @param {{
977+ */ foo
978+ """ )
979+ {tokens } = grammar .tokenizeLine (' /' )
980+ expect (lines[0 ][5 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' , ' punctuation.definition.bracket.curly.begin.jsdoc' ]
981+ expect (lines[0 ][6 ]).toEqual value : ' {' , scopes : [' source.js' , ' comment.block.documentation.js' , ' entity.name.type.instance.jsdoc' ]
982+ expect (lines[1 ][1 ]).toEqual value : ' */' , scopes : [' source.js' , ' comment.block.documentation.js' , ' punctuation.section.end.comment.js' ]
983+ expect (lines[1 ][2 ]).toEqual value : ' foo' , scopes : [' source.js' ]
968984
969985 it " tokenises @return tags without descriptions" , ->
970986 {tokens } = grammar .tokenizeLine (' /** @return {object} */' )
0 commit comments