Skip to content

Commit 7d2a85d

Browse files
committed
feat(vscode): enhance backup functionality for configuration files
- Added tasks to create backup parent directories for config items and vscode files before removal. - Implemented backup tasks in all.yml and vscode.yml to ensure existing files are preserved during updates. - Updated main.yml to include "Cursor" in the list of applications for configuration management. - Improved overall file handling and backup processes for better maintainability and data safety.
1 parent c324eb4 commit 7d2a85d

File tree

4 files changed

+61
-7
lines changed

4 files changed

+61
-7
lines changed

config/vscode/Application Support/settings.json

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"editor.accessibilitySupport": "off",
4242
"editor.bracketPairColorization.enabled": true,
4343
"editor.codeActionsOnSave": {
44-
"source.fixAll.eslint": "explicit"
44+
"source.fixAll.eslint": "explicit",
45+
"source.addMissingImports": "explicit",
46+
// "source.organizeImports": "explicit"
4547
},
4648
"editor.formatOnPaste": true,
4749
"editor.formatOnSave": true,
@@ -60,9 +62,9 @@
6062
"git.autofetch": true,
6163
"git.enableSmartCommit": true,
6264
"github.copilot.enable": {
63-
"*": true,
64-
"markdown": true,
65+
"*": false,
6566
"plaintext": true,
67+
"markdown": true,
6668
"scminput": false,
6769
"typescript": true,
6870
"yaml": true
@@ -73,11 +75,22 @@
7375
"gitlens.hovers.currentLine.over": "line",
7476
"go.lintFlags": [
7577
"--config=${workspaceFolder}/.golangci.yaml",
76-
"--fast"
78+
"--path-mode=abs",
79+
"--fast-only"
80+
// "--fast"
7781
],
82+
"go.formatTool": "custom",
7883
"go.lintTool": "golangci-lint",
84+
"go.alternateTools": {
85+
"customFormatter": "golangci-lint"
86+
},
87+
"go.formatFlags": [
88+
"fmt",
89+
"--stdin"
90+
],
7991
"gopls": {
80-
"ui.diagnostic.staticcheck": true
92+
// "ui.diagnostic.staticcheck": true,
93+
// "ui.navigation.importShortcut": "Definition"
8194
},
8295
"hediet.vscode-drawio.resizeImages": null,
8396
"hediet.vscode-drawio.theme": "atlas",
@@ -148,7 +161,6 @@
148161
"workbench.editorAssociations": {
149162
"*.ipynb": "jupyter.notebook.ipynb"
150163
},
151-
"workbench.iconTheme": "vscode-icons",
152164
"workbench.settings.applyToAllProfiles": [
153165
"workbench.editor.languageDetection"
154166
],
@@ -223,5 +235,18 @@
223235
"options": [
224236
"-I=~/.cache/buf/v1/module/data/buf.build"
225237
]
226-
}
238+
},
239+
"cursor.cpp.disabledLanguages": [
240+
"scminput"
241+
],
242+
"search.exclude": {
243+
"/gen/": true
244+
},
245+
"cursor.composer.shouldChimeAfterChatFinishes": true,
246+
"cursor.composer.collapsePaneInputBoxPills": true,
247+
"markdown-preview-enhanced.printBackground": true,
248+
"workbench.iconTheme": "vscode-icons",
249+
"update.releaseTrack": "prerelease",
250+
"diffEditor.hideUnchangedRegions.enabled": true,
251+
"docker.extension.enableComposeLanguageServer": false
227252
}

scripts/ansible/roles/config/tasks/all.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
with_items: "{{ vars.config_items }}"
3737
register: check_config_items
3838

39+
- name: Make backup parent directories for config_items files
40+
ansible.builtin.file:
41+
path: "{{ vars.backup_dir }}/{{ item.stat.path | dirname }}"
42+
state: directory
43+
mode: "0755"
44+
with_items: "{{ check_config_items.results | selectattr('stat.exists') | selectattr('stat.islnk', 'equalto', false) | list }}"
45+
3946
- name: Backup config_items files
4047
ansible.builtin.copy:
4148
src: "{{ item.stat.path }}"
@@ -73,6 +80,13 @@
7380
with_items: "{{ vars.direct_home_files }}"
7481
register: check_direct_home_files
7582

83+
- name: Make backup parent directories for direct home files
84+
ansible.builtin.file:
85+
path: "{{ vars.backup_dir }}/{{ item.stat.path | dirname }}"
86+
state: directory
87+
mode: "0755"
88+
with_items: "{{ check_direct_home_files.results | selectattr('stat.exists') | selectattr('stat.islnk', 'equalto', false) | list }}"
89+
7690
- name: Backup direct home files
7791
ansible.builtin.copy:
7892
src: "{{ item.stat.path }}"

scripts/ansible/roles/config/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
with_items:
1313
- "Code"
1414
- "Code - Insiders"
15+
- "Cursor"
1516
loop_control:
1617
loop_var: vscode_dir_name

scripts/ansible/roles/config/tasks/vscode.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
- "{{ vars.config_dir }}/vscode/Application Support/snippets/*"
77
register: vscode_files
88

9+
- name: Make backup parent directories for vscode files
10+
ansible.builtin.file:
11+
path: "{{ vars.backup_dir }}/{{ item.stat.path | dirname }}"
12+
state: directory
13+
mode: "0755"
14+
with_items: "{{ vscode_files.results | selectattr('stat.exists') | selectattr('stat.islnk', 'equalto', false) | list }}"
15+
16+
- name: Backup vscode files in ~/Library/Application Support/Code/User
17+
ansible.builtin.copy:
18+
src: "{{ item.stat.path }}"
19+
dest: "{{ vars.backup_dir }}/{{ item.stat.path }}"
20+
mode: "0644"
21+
with_items: "{{ vscode_files.results | selectattr('stat.exists') | selectattr('stat.islnk', 'equalto', false) | list }}"
22+
923
- name: Remove vscode files in ~/Library/Application Support/Code/User
1024
ansible.builtin.file:
1125
path: "{{ item.stat.path }}"

0 commit comments

Comments
 (0)