Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit84ed6a3

Browse files
authored
Make sure that jsdoc is always in range with parameter declaration (microsoft#58538)
1 parent4ece0a3 commit84ed6a3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎src/compiler/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,6 +2474,7 @@ export function getJSDocCommentRanges(node: Node, text: string) {
24742474
getLeadingCommentRanges(text,node.pos);
24752475
// True if the comment starts with '/**' but not if it is '/**/'
24762476
returnfilter(commentRanges,comment=>
2477+
comment.end<=node.end&&// Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
24772478
text.charCodeAt(comment.pos+1)===CharacterCodes.asterisk&&
24782479
text.charCodeAt(comment.pos+2)===CharacterCodes.asterisk&&
24792480
text.charCodeAt(comment.pos+3)!==CharacterCodes.slash);

‎src/testRunner/unittests/incrementalParser.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function insertCode(source: string, index: number, toInsert: string) {
120120
}
121121
}
122122

123-
describe("unittests::Incremental Parser",()=>{
123+
describe("unittests::incrementalParser::",()=>{
124124
it("Inserting into method",()=>{
125125
constsource="class C {\r\n"+
126126
" public foo1() { }\r\n"+
@@ -806,6 +806,15 @@ module m3 { }\
806806
deleteCode(source,index,"extends IFoo<T>");
807807
});
808808

809+
it("when comment changes to incomplete",()=>{
810+
constsource="function bug(\r\n test /** */ true = test test 123\r\n) {}";
811+
constoldText=ts.ScriptSnapshot.fromString(source);
812+
constindex=source.indexOf("/");
813+
constnewTextAndChange=withChange(oldText,index,1,"");
814+
815+
compareTrees(oldText,newTextAndChange.text,newTextAndChange.textChangeRange,0);
816+
});
817+
809818
it("Type after incomplete enum 1",()=>{
810819
constsource="function foo() {\r\n"+
811820
" function getOccurrencesAtPosition() {\r\n"+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp