Skip to content

Conversation

@jakebailey
Copy link
Member

Before:

image

After:

image

Confusingly, no existing fourslash test seems to test this? I was seeing it all the time.

This one flag is not the extent of the flags hover used to set; it also used to sometimes set MultilineObjectLiterals for type display parts, but doing that regressed the existing tests. MultilineObjectLiterals, WriteTypeArgumentsOfSignature, OmitParameterModifiers used to be set for signature display parts, but it wasn't immediately obvious to me where to set that.

Mainly, I just want to stop seeing the random import nodes which Strada does not show.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the TypeScript hover functionality to improve type display by setting the UseAliasDefinedOutsideCurrentScope flag for type formatting. This change ensures that type aliases defined outside the current scope are properly displayed in hover information, preventing the display of random import nodes that were confusing users.

Key Changes

  • Updates typeFormatFlags to include UseAliasDefinedOutsideCurrentScope flag for better type alias resolution in hover displays
Comments suppressed due to low confidence (1)

internal/ls/hover.go:18

  • This change to type formatting flags lacks test coverage. Consider adding a fourslash test that verifies hover behavior with type aliases defined outside the current scope to ensure this flag works as expected.
	typeFormatFlags   = checker.TypeFormatFlagsUseAliasDefinedOutsideCurrentScope

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Aug 5, 2025

I'm guessing we have tests that are not ported (non-baseline ones). In the meantime, can you add a non-generated test which previously exhibits the behavior? I feel like that should be pretty easy to repro.

@jakebailey jakebailey force-pushed the jabaile/hover-type-format-flags branch from 9880a6a to 752e2f5 Compare August 5, 2025 04:10
@jakebailey
Copy link
Member Author

Rebased with a test that shows the difference.

@jakebailey jakebailey added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit 807ee7f Aug 5, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/hover-type-format-flags branch August 5, 2025 17:03
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.

3 participants