Skip to content
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

improvement:don't show types for match case for showInferredType #5284

Merged
merged 9 commits into from
Jul 21, 2023

Conversation

doofin
Copy link
Contributor

@doofin doofin commented May 28, 2023

previously, showInferredType will show types even for long cases like below:
image

if we don't show cases the effect is like below(this PR):
image

In my opinion, showing too much information like everything in match case isn't very helpful, but showing types elsewhere is quite nice. although we can toggle showInferredType, it's a bit tedious to do so and I end up not using this functionality.

feel free to suggest edits (maybe only enable showInferredType when case contains one field?)

@@ -488,7 +488,8 @@ final class SyntheticsDecorationProvider(
case param: m.Term.Param =>
if (param.decltpe.isEmpty) List(param.name.pos.toSemanticdb) else Nil
case cs: m.Case =>
explorePatterns(List(cs.pat)) ++ visit(cs.body)
// if the case is too long then it'll be too messy
visit(cs.body) // explorePatterns(List(cs.pat)) ++ visit(cs.body)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't agree about removing this, since it might be useful to know the type in case.

We might be over eager in case of inferred type for methods, we could for sure separate it under another flag (or rethink the settings here to be more useful).

Any other opininos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could also be nice to provide more options like showInferredType = minimal| full | etc...

Copy link
Member

Choose a reason for hiding this comment

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

+1 for more granularity

@doofin doofin marked this pull request as draft June 3, 2023 19:35
@doofin
Copy link
Contributor Author

doofin commented Jun 7, 2023

I have add more fine grained options for showInferredType and , but it's failing WorksheetLspSuite test, not sure how to fix this. feel free to have a look @tgodzik @kpodsiad

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

Totally forgot about your PR, sorry about that! I think that's a smart idea with switching the setting. This might require some tinkering on Vs Code sie, but can be done later on without na issue.

I would however add a test case for this option in SyntheticDecorationsLspSuite, just repeat the 54-89 lines with the setting switched.

@doofin
Copy link
Contributor Author

doofin commented Jul 13, 2023

@tgodzik I just added a test in SyntheticDecorationsLspSuite

@doofin doofin marked this pull request as ready for review July 13, 2023 20:07
@tgodzik
Copy link
Contributor

tgodzik commented Jul 14, 2023

Thanks! We seem to have a lot tests failing in the PR, but it's not clear to me why. I will try and rerun and if that doesn't help I will take a look next week.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 14, 2023

Ok cool, seems that the tests were flaky. I will try and get this merged after the next release. I am stoping merging anything but fixes until the release next week.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM

One thing we should do is to change the options to enum on the VS Code setting and change the toggle command to go though the options instead of false/true.

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.

4 participants