Skip to content

Conversation

@a-tarasyuk
Copy link
Contributor

Fixes #2426

Comment on lines +142 to +151
targetRange := lsproto.Range{
Start: lsproto.Position{
Line: 0,
Character: 0,
},
End: lsproto.Position{
Line: 0,
Character: 0,
},
}
Copy link
Member

@DanielRosenwasser DanielRosenwasser Dec 29, 2025

Choose a reason for hiding this comment

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

To minimize some of the diffs, can you do something like this?

l.converters.ToLSPRange(reference.file, reference.file.Loc)

(not sure if file might be nil though)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Several differences in this PR are due to handling whitespace at the start of the file, for example

In that case, createLspRangeFromNode or createLspRangeFromRange should take care of those differences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These diffs are related to missing chompLeadingSpace from the test parser. I’m not sure whether this behavior should be preserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a couple of failing formatting tests, but they’re all in gen folder, which shouldn’t be modified directly. We probably need to regenerate the tests for these cases. For example, Strada behaviour for some of them,

this test has 4 spaces after ///
https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/tests/cases/fourslash/semicolonFormattingInsideAStringLiteral.ts#L3

but the behavior is validated with 3 spaces
https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/tests/cases/fourslash/semicolonFormattingInsideAStringLiteral.ts#L9

Anyway, the remaining question is whether we should proceed with or without the chompLeadingSpace helper.

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.

goToDefinition for pattern ambient module no longer goes to implementation

2 participants