Skip to content

getTokenAtPosition: default includeJsDocComment to true #25015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
7 commits merged into from
Jun 26, 2018
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jun 16, 2018

Sequel to #23379. Would have made #25014 unnecessary.

@ghost ghost requested a review from sheetalkamat June 16, 2018 00:54
@ghost ghost force-pushed the getTokenAtPosition branch from f451235 to 35da4ae Compare June 18, 2018 16:07
@@ -661,8 +661,8 @@ namespace ts {
}

/** Returns a token if position is in [start-of-leading-trivia, end) */
export function getTokenAtPosition(sourceFile: SourceFile, position: number, includeJsDocComment: boolean, includeEndPosition = false): Node {
return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includePrecedingTokenAtEndPosition*/ undefined, includeEndPosition, includeJsDocComment);
export function getTokenAtPosition(sourceFile: SourceFile, position: number, includeJsDocComment = true): Node {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the change it looks like there is no place remaining where we need includeJsDocComment as false? Why have a parameter then. If this is rare scenario may be change the parameter to take optional value without assigning default and do !!ignoreJsDocComment so that we save assigning default value to the parameter

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few left actually, though they're suspicious. #25162

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case I wouldn't make this parameter optional (could be done in #25612) but here we should keep the comments and pass true I think. Making it optional makes it more confusing.

@ghost
Copy link
Author

ghost commented Jun 22, 2018

Latest commit fixes #25162

@ghost
Copy link
Author

ghost commented Jun 26, 2018

@sheetalkamat Please re-review

@@ -38,7 +38,7 @@ verify.completions(
{ marker: "quoteInComment", exact: undefined, triggerCharacter: '"' },
{ marker: "lessInComment", exact: undefined, triggerCharacter: "<" },

{ marker: "openTag", includes: "div", triggerCharacter: "<" },
{ marker: "openTag", exact: undefined, triggerCharacter: "<" }, // TODO: `includes: "div"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there issue opened for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by #25167

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants