Skip to content

Commit 24201cf

Browse files
fuafasandersn
authored andcommitted
Add support for jsdoc properties with hyphen (microsoft#32631)
1 parent 5ac4505 commit 24201cf

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/compiler/scanner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ namespace ts {
21822182

21832183
if (isIdentifierStart(ch, languageVersion)) {
21842184
let char = ch;
2185-
while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion)) pos += charSize(char);
2185+
while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === CharacterCodes.minus) pos += charSize(char);
21862186
tokenValue = text.substring(tokenPos, pos);
21872187
if (char === CharacterCodes.backslash) {
21882188
tokenValue += scanIdentifierParts();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
///<reference path="fourslash.ts" />
2+
// @allowJs: true
3+
// @Filename: dummy.js
4+
5+
//// /**
6+
//// * @typedef Product
7+
//// * @property {string} title
8+
//// * @property {boolean} h/*1*/igh-top some-comments
9+
//// */
10+
////
11+
//// /**
12+
//// * @type {Pro/*2*/duct}
13+
//// */
14+
//// const product = {
15+
//// /*3*/
16+
//// }
17+
verify.quickInfoAt('1', '(property) high-top: boolean', 'some-comments');
18+
19+
verify.quickInfoAt('2', 'type Product = {\n title: string;\n high-top: boolean;\n}');
20+
21+
verify.completions({
22+
marker: ['3'],
23+
includes: ['"high-top"']
24+
});

0 commit comments

Comments
 (0)