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

DSC resource to configure Visual Studio Code workspace settings #69

Open
Gijsreyn opened this issue Oct 14, 2024 · 1 comment
Open

DSC resource to configure Visual Studio Code workspace settings #69

Gijsreyn opened this issue Oct 14, 2024 · 1 comment

Comments

@Gijsreyn
Copy link
Contributor

Description of the new feature / enhancement

I'd like a DSC resource so I can configure Visual Studio Code workspace settings.

Proposed technical implementation details

No response

@Gijsreyn
Copy link
Contributor Author

Hi @denelon,

I have been experimenting with Visual Studio Code workspace settings and have opened a PR that covers approximately 80-85% of the settings. I tried adding enums to make things more configurable.

Although VSCode offers many ways to configure and sync settings, exporting through DSC v3 can potentially help users discover available settings and configure them consistently.

Lastly, this was also to kickstart the idea to see if it is feasible for this repository. If it is not, I understand. Could you please let me know if that’s the case? Thanks in advance.

P.S.: For the record, I'm lazy in writing. I'm grabbing all available settings from the settings.md. I have created two functions that parse the output and return the whole class with enum as script content. It goes something like:

$settings = Get-VSCodeSettings

$groups = $settings | Sort-Object -Property Setting -Unique | Group-Object -Property Category
$filter = $groups | Where-Object { $_.Name -notin @('_os', '_vscode') -and $_.Name -notlike '`[*' -and $_.Name -notlike '`**' }
foreach ($group in $filter)
{
    $class = New-VSCodeSettingClass -settings $group.Group
    $filePath = "C:\Source\winget-dsc\output\$($group.Name)Setting.ps1"
    try {
        $class | Out-File -FilePath "C:\Source\winget-dsc\output\$($group.Name)Setting.ps1" -ErrorAction Stop
    } catch {
        Write-Host "Error writing $($group.Name)Setting.ps1"
        Write-Host $_.Exception.Message

        continue;
    }
    try {
        . $filePath

        $content = Get-Content $filePath -Raw
        $content | Add-Content -Path C:\Source\winget-dsc\resources\Microsoft.VSCode.Dsc\test.psm1
    } catch {
        Write-Host "Error loading $($group.Name)Setting.ps1"
        Write-Host $_.Exception.Message

        continue;
    }
}

If you want, I can always share the script.

@denelon denelon added this to WinGet Oct 22, 2024
@denelon denelon moved this to To Do in WinGet Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Do
Development

No branches or pull requests

2 participants