Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/astnav/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ func findRightmostValidToken(endPos int, sourceFile *ast.SourceFile, containingN
if rightmostValidNode != nil {
endPos = rightmostValidNode.End()
}
return find(rightmostValidNode, endPos)
result := find(rightmostValidNode, endPos)
if result == nil && n != containingNode {
return n
}
Comment thread
Andarist marked this conversation as resolved.
Outdated
return result
}

return find(containingNode, endPos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import x =/*3*/
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
},
Items: &fourslash.CompletionsExpectedItems{
Includes: []fourslash.CompletionsExpectedItem{}, // no crash check
},
Items: &fourslash.CompletionsExpectedItems{},
Comment thread
Andarist marked this conversation as resolved.
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
. "github.com/microsoft/typescript-go/internal/fourslash/tests/util"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestCompletionClassMemberAfterJSDocWithInvalidJSDocTagInTheComment1(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export class NeedsPrefix {
private _prefixes: {
add: Record<string, any>;
browsers: {selected: string[]};
};

constructor(browsers: string[]) {
}

/** Checks whether an @-rule needs to be prefixed. */
/**/atRule(identifier: string): boolean {
return true;
}
}`
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
defer done()
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &[]string{},
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{},
})
}