coder / modules

A collection of Terraform Modules to extend Coder templates.
https://registry.coder.com
Apache License 2.0
32 stars 28 forks source link

code-server module not loading settings #118

Closed Conor-Behard333 closed 8 months ago

Conor-Behard333 commented 9 months ago

Hi, I am using the code server module and the settings are not being ported over to the code-server user space Here is the tf module for my template:

module "code-server" { 
  source = "https://registry.coder.com/modules/code-server" 
  agent_id = coder_agent.main.id 
  folder = "/home/coder/workspace/repo" 
  settings = { "workbench.colorTheme" = "Default Light Modern", "workbench.iconTheme" = "vscode-icons", "files.autoSave" = "onFocusChange", "editor.rulers" = "[80,120]", "update.mode" = "none", } 
  extensions = [ "ms-azuretools.vscode-docker", "sugatoray.vscode-git-extension-pack", "golang.Go", "ms-python.python", "redhat.vscode-yaml", "timonwong.shellcheck", "garlicbreadcleric.pandoc-markdown-syntax", "zaaack.markdown-editor", "hashicorp.terraform", "ms-kubernetes-tools.vscode-kubernetes-tools" ]
 }

After a little investigating into this script: https://github.com/coder/modules/blob/main/code-server/run.sh Looking at the logs of my workspace "⚙️ Creating settings file..." is never outputted which means

if [ ! -f ~/.local/share/code-server/Machine/settings.json ]; then

is returning true.

Not sure why this is as when I destroy the workspace it should be gone and recreating it still causes this issue.

matifali commented 9 months ago

@Conor-Behard333 can you check if there is a ~/.local/share/code-server/Machine/settings.json file by running,

cat ~/.local/share/code-server/Machine/settings.json
Conor-Behard333 commented 9 months ago

yeah it is there, it contains { "git.useIntegratedAskPass": false, "github.gitAuthentication": false }

when I change a setting through vscode the settings get added to ~/.local/share/code-server/User/settings.json

matifali commented 9 months ago

@Conor-Behard333 also on a fresh workspace do you have both ~/.local/share/code-server/User/settings.json and ~/.local/share/code-server/Machine/settings.json?

I am thinking if one of them is empty, we may probably add a new option to the module with the name settings_scope that defaults to Machine to keep the original behavior but allows passing User to set Settings as the User.

cc: @code-asher if you can provide more context here on what is happening.

Conor-Behard333 commented 9 months ago

on a fresh workspace I have ~/.local/share/code-server/Machine/settings.json but ~/.local/share/code-server/User/settings.json is only created once I make a manual change in vscode (change the theme for example)

So it sounds like your solve would work

code-asher commented 9 months ago

A few observations:

Conor-Behard333 commented 8 months ago

Any updates on this?