We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Revives #13574
Fixes #5890, fixes #6320, fixes #10681, fixes #26906
Sorry, something went wrong.
use last line indentation on formatter
7561ec0
... and add explicit delta suppressor for list end tokens
remove deprecated function
d7f1935
add getListByPosition
cd19a89
indent using list start position before first list item
655bf20
indent using list start position
ac51733
tests
90d5413
resolve TODO
c6174f6
indent size 8 based on list startline indentation
7bc40ce
strict types
7fa447b
adjust test: always indented inside a list
8ed21a8
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
function getListIfVisualStartEndIsInListRange(list: NodeArray<Node> | undefined, start: number, end: number, node: Node, sourceFile: SourceFile): NodeArray<Node> | undefined { return list && rangeContainsStartEnd(getListRange(node, list, sourceFile), start, end) ? list : undefined; } function getListRange(node: Node, list: TextRange, sourceFile: SourceFile): TextRange { const children = node.getChildren(sourceFile); for (let i = 1; i < children.length - 1; i++) { if (children[i].pos === list.pos && children[i].end === list.end) { return { pos: children[i - 1].end, end: children[i + 1].getStart(sourceFile) }; } } return list; }
sourceFile
NodeArray starts at the previous token's end positions and ends at the last list item's end position. So think about the following code:
func( / visually the list starts at line 0 and ends in line 2, but actually it ends at line 0 ); func( 1, / visually the list starts at line 0 and ends in line 3, but actually it ends at line 1 / which means the position of these comments does not belong to the list range. );
apply suggested changes
7995f91
You could create a closure so you don't have to repeat the arguments start, end, node, sourceFile everywhere.
start, end, node, sourceFile
I'm pulling this in, and if we'd like to address any changes related to code cleanliness or perf we can do this after. Thank you so much for sticking it out and sending out these changes again.
⭐️ ⭐️ ⭐️ ⭐️ ⭐️ ❤️
02ca5be
sheetalkamat sheetalkamat approved these changes
sheetalkamat
Successfully merging this pull request may close these issues.