diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 3f7db7d2eb3..af9f565fb52 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -2182,7 +2182,7 @@ namespace ts { if (isIdentifierStart(ch, languageVersion)) { let char = ch; - while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion)) pos += charSize(char); + while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === CharacterCodes.minus) pos += charSize(char); tokenValue = text.substring(tokenPos, pos); if (char === CharacterCodes.backslash) { tokenValue += scanIdentifierParts(); diff --git a/tests/cases/fourslash/jsDocTagsWithHyphen.ts b/tests/cases/fourslash/jsDocTagsWithHyphen.ts new file mode 100644 index 00000000000..188c4298bcb --- /dev/null +++ b/tests/cases/fourslash/jsDocTagsWithHyphen.ts @@ -0,0 +1,24 @@ +/// +// @allowJs: true +// @Filename: dummy.js + +//// /** +//// * @typedef Product +//// * @property {string} title +//// * @property {boolean} h/*1*/igh-top some-comments +//// */ +//// +//// /** +//// * @type {Pro/*2*/duct} +//// */ +//// const product = { +//// /*3*/ +//// } +verify.quickInfoAt('1', '(property) high-top: boolean', 'some-comments'); + +verify.quickInfoAt('2', 'type Product = {\n title: string;\n high-top: boolean;\n}'); + +verify.completions({ + marker: ['3'], + includes: ['"high-top"'] +});