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

chore: use enum with default value for modelling show inferred types #5502

Closed
wants to merge 1 commit into from

Conversation

kpodsiad
Copy link
Member

@kpodsiad kpodsiad commented Aug 1, 2023

quick prototype showing what I meant in scalameta/metals-vscode#1412 (comment)

  1. Can we use default value to remove Option for this config? Does it make a difference to treat no value case as off?
  2. I'd ask a few "what if" questions about possible future variants for this enum. Maybe what we need is more granular, json-like config? For example {"case": false, "vals": true, ...}. I find some value in such config and I'd use it myself. Would it be useful for other users and project thought?
  3. UserConfiguration might need some refactor to support fallback/legacy encoding of options without treating failures as errors, for now I went with the quickest way - boolean flag.
    cc: @tgodzik

@@ -484,7 +489,15 @@ object UserConfiguration {
val superMethodLensesEnabled =
getBooleanKey("super-method-lenses-enabled").getOrElse(false)
val showInferredType =
getStringKey("show-inferred-type")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to use getBooleanKey, it seems that getStringKey was working even with boolean values?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about for a while, if getStringKey is working then we can leave it

def isNotDisabled: Boolean = !isDisabled
}

object ShowInferredType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably ideal scenario would be a json config, but that is much harder to model in the UI. Something like git lenses would be great where we would have a separate webview with the settings and turning them on/off would show the results immediately on a sample code. I think we could do that later as a totally different setting and then deprecate these.

On the other hand, the boolean or enum settings are quite easy to toggle on/off, which might be more complex to do in the scenario I am suggesting. We could just keep toogle options that would enable/disable a subset of configuration 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we could do that later as a totally different setting and then deprecate these.

ok, sounds reasonable

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think adding a settings page for those sounds like a great project for anyone who knows typescript a bit better 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, now as we're on the same page, I'm closing PR

@kpodsiad kpodsiad closed this Aug 3, 2023
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