mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Check if inside the declaration
This commit is contained in:
parent
acb9401345
commit
24b29f1fb7
@ -1945,7 +1945,7 @@ module FourSlash {
|
||||
let actual = this.languageService.getDocCommentScaffoldingAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
|
||||
if (actual.newText !== expected.newText) {
|
||||
this.raiseError('verifyDocCommentScaffolding failed - expected insertion:\n' + expected.newText + 'actual insertion:\n' + actual.newText);
|
||||
this.raiseError('verifyDocCommentScaffolding failed - expected insertion:\n' + expected.newText + '\nactual insertion:\n' + actual.newText);
|
||||
}
|
||||
|
||||
if (actual.cursorOffset !== expected.cursorOffset) {
|
||||
|
||||
@ -6778,7 +6778,7 @@ namespace ts {
|
||||
let nodeAtPos = getTokenAtPosition(sourceFile, position);
|
||||
let containingFunction = <FunctionDeclaration>getAncestor(nodeAtPos, SyntaxKind.FunctionDeclaration);
|
||||
|
||||
if (hasDocComment(sourceFile, position) || !containingFunction) {
|
||||
if (hasDocComment(sourceFile, position) || !containingFunction || containingFunction.getStart() < position) {
|
||||
return emptyCompletion;
|
||||
}
|
||||
|
||||
|
||||
@ -432,7 +432,7 @@ namespace ts {
|
||||
extraCheck: (c: CommentRange) => boolean): boolean {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
|
||||
if (token && position < token.getStart()) {
|
||||
if (token && position <= token.getStart()) {
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
return forEach(commentRanges, c => c.pos < position &&
|
||||
@ -442,6 +442,7 @@ namespace ts {
|
||||
// // asdf ^\n
|
||||
//
|
||||
// But for multi-line comments, we don't want to be inside the comment in the following case:
|
||||
//
|
||||
// /* asdf */^
|
||||
//
|
||||
// Internally, we represent the end of the comment at the newline and closing '/', respectively.
|
||||
|
||||
@ -379,7 +379,7 @@ module FourSlashInterface {
|
||||
}
|
||||
|
||||
// Will fix in fourslash-referencing
|
||||
public DocCommentScaffolding(position: number, expectedText: string, expectedOffset: number) {
|
||||
public DocCommentScaffolding(expectedText: string, expectedOffset: number) {
|
||||
FourSlash.currentTestState.verifyDocCommentScaffolding({ newText: expectedText, cursorOffset: expectedOffset });
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user