Skip to content

Sort VSCode settings to put common settings first #813

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

Merged
merged 3 commits into from
Jul 4, 2022

Conversation

paul-schaaf
Copy link
Contributor

closes #389

I've taken the liberty to also group the hat settings. let me know if I should revert it!

For some reason one of the hat settings still shows up first. I've looked into the vscode docs but wasn't able to find anything on it.I am guessing it is a bug in vscode. But maybe I also made a mistake somewhere.

@paul-schaaf paul-schaaf requested a review from pokey as a code owner July 2, 2022 19:09
README.md Outdated
- `cursorless.hatSettings.hatEnablement.shapes`: Whether to enable particular hat shapes.
- `cursorless.hatSettings.hatPenalties.colors`: How much to penalize each hat color. You will probably want to set this one to the number of syllables in the given style. Cursorless will then sort every style combination by number of syllables to refer to it.
- `cursorless.hatSettings.hatPenalties.shapes`: How much to penalize each hat shape. You will probably want to set this one to the number of syllables in the given style. Cursorless will then sort every style combination by number of syllables to refer to it.
- `cursorless.hatSettings.maximumHatStylePenalty`: The maximum allowed penalty for a hat style. Any hat style whose penalty is greater than this amount will not be used. A hat style penalty is defined to be the shape penalty plus the colour penalty. Setting this value less than or equal to zero is treated as no maximum.
Copy link
Member

Choose a reason for hiding this comment

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

If these names change then we need some migration code for those that have modified these settings. I don't see any.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Thanks for taking a crack at this one! Good direction, but as @auscompgeek mentions, this PR will break everyone's Cursorless who has used any hat settings 😅. You'll need to modify the code that reads the settings to be able to handle the old as well as the new paths

package.json Outdated
@@ -335,14 +345,16 @@
},
"additionalProperties": false
},
"cursorless.maximumHatStylePenalty": {
"cursorless.hatSettings.hatPenalties.maximumHatStylePenalty": {
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't really have any impact on hat penalties, so I don't think I'd put it in that group

Suggested change
"cursorless.hatSettings.hatPenalties.maximumHatStylePenalty": {
"cursorless.hatSettings.maximumHatStylePenalty": {

Comment on lines 96 to 106
const userSizeAdjustment = vscode.workspace
.getConfiguration("cursorless")
.getConfiguration("cursorless.hatSettings")
.get<number>(`hatSizeAdjustment`)!;

const userVerticalOffset = vscode.workspace
.getConfiguration("cursorless")
.getConfiguration("cursorless.hatSettings")
.get<number>(`hatVerticalOffset`)!;

const userIndividualAdjustments = vscode.workspace
.getConfiguration("cursorless")
.getConfiguration("cursorless.hatSettings")
.get<IndividualHatAdjustmentMap>("individualHatAdjustments")!;
Copy link
Member

@pokey pokey Jul 4, 2022

Choose a reason for hiding this comment

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

You can prob add a new function like the following and use it in all the above places:

function getHatSetting<T>(name: string): T | undefined {
  return (
    vscode.workspace.getConfiguration("cursorless.hatSettings").get<T>(name) ??
    vscode.workspace.getConfiguration("cursorless").get<T>(name)
  );
}

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

On second, thought, though, I'm not sure we want to group the hat settings. The hat enablement settings are far more common than the other ones. I think probably better to arrange settings by how likely they are to be used, rather than category. Here's the order I'd suggest:

  1. Cursorless: Hat Size Adjustment
  2. Cursorless: Hat Vertical Offset
  3. Cursorless › Hat Enablement: Colors
  4. Cursorless › Hat Enablement: Shapes
  5. Cursorless › Colors: Light
  6. Cursorless › Colors: Dark

Then after that I think they're all less common so doesn't matter as much

@paul-schaaf
Copy link
Contributor Author

@pokey done!

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Great thanks!

@pokey pokey changed the title Group and arrange settings Sort VSCode settings to put common settings first Jul 4, 2022
@pokey pokey merged commit d7ada0c into cursorless-dev:main Jul 4, 2022
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.

Order settings
3 participants