Skip to content

Error occurs if settings.json does not exist (such as for new install before any settings are changed) #3030

@CodesAway

Description

@CodesAway

I found an interesting scenario and wanted to check how I should handle it.

I was practicing my demo for my new tool - Talon Automated Installation Platform (TAIP) - https://github.com/CodesAway/TAIPCodesAway

This is able to install Talon command sets and VSCode extensions, such as Cursorless.

I learned that a brand new install of VSCode has no settings.json file, and I kept getting errors from the below code, since the settings.json file didn't exist. It only gets created when you modify a setting (opening VSCode won't create the file)

def setup_hat_styles_csv(hat_colors: dict[str, str], hat_shapes: dict[str, str]):

When I created an empty settings.json file with "{}", it worked fine (no error)

The error happens when this method cannot find the settings.json and read it as dict, an error occurs.

def vscode_get_setting(key: str, default_value: Any = None): # pyright: ignore [reportGeneralTypeIssues]

In the meanwhile, I was thinking since my tool is installing Cursorless anyway, I can create the empty dict settings.json file first, so Cursorless doesn't result in an error, confusing new users who have a fresh install of VSCode.

Thoughts? Concerns? Questions? ⁉️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions