인스턴스간에 내 Visual Studio Code 설정을 동기화하는 방법이 있습니까?
VS Code 사용자 설정 (파일> 기본 설정> 사용자 설정)을 어떻게 든 클라우드에 동기화하여 Windows 10 및 Visual Studio에서와 같이 여러 설치간에 쉽게 공유 할 수 있기를 원합니다.
이 작업을 지원하는 방법이 있습니까? 코드에서 직접 지원하는 것도 좋지만, 그렇지 않으면 settings.json 위치를 Dropbox 또는 OneDrive 폴더로 옮길 수도 있습니다.
저는이 작업을 자동으로 조용히 수행하는 방법을 구체적으로 찾고 있습니다. 수동 내보내기 / 가져 오기는 너무 번거롭고 내가 찾고있는 것이 아닙니다.
업데이트 : 여기에 기능 요청이 있습니다 . 이 기능을 원하시면 좋아요를 눌러주세요.
여러 인스턴스에서 모든 Visual Studio 코드 설정을 동기화하는 확장을 개발했습니다.
주요 특징들
- github 계정 토큰을 사용하십시오.
- 한 번의 클릭으로 업로드 및 다운로드가 쉽습니다.
- 모든 설정 및 스 니펫 파일을 저장합니다.
- 업로드 키 : Shift + Alt + u
- 다운로드 키 : Shift + Alt + d
- 모든 동기화 옵션을 보려면 동기화를 입력하십시오.
그것은 동기화
- 설정 파일
- 키 바인딩 파일
- 파일 시작
- 스 니펫 폴더
- VSCode 확장
상세 문서 소스
여기에서 다운로드 : VS 코드 설정 동기화
사용자 설정이 포함 된 디렉터리에서 Dropbox 또는 OneDrive와 같은 응용 프로그램의 동기화 디렉터리로 하드 링크를 만들 수 있습니다.
예를 들어 Windows에서 사용자 설정은에 %APPDATA%\Code\User
있으므로 다음을 입력 할 수 있습니다.
mklink /H /J X:\Your\Sync\Dir %APPDATA%\Code\User
Visual Studio Code를 사용하여 컴퓨터에서 동기화를 수행합니다.
그런 다음 다른 컴퓨터에서 %APPDATA%\Code\User
폴더를 삭제 하고 다음을 입력 할 수 있습니다 .
mklink /H /J %APPDATA%\Code\User X:\Your\Sync\Dir
동기화 된 설정을 검색합니다.
아하, 내 VSCode 확장 : Syncing .
당신이 그것을 좋아하기를 바랍니다. :)
퀵 가이드
동기화 설치 :
나만의 것을 얻으십시오
GitHub Personal Access Token
:GitHub
Settings
페이지에 로그인 하십시오.Personal access tokens
탭을 선택 하고을 클릭Generate new token
합니다.를 선택
gist
하고 클릭Generate token
합니다.토큰을 복사하고 백업하십시오.
설정 동기화 :
Syncing
필요한 정보for the first time
와save for later use
.업로드 :
입력
upload
에서VSCode Command Palette
.귀하의 입력
GitHub Personal Access Token
.귀하의
Gist ID
(또는leave it blank
자동 생성)을 입력하십시오 .끝난!
After uploading, you can find your settings and the corresponding
Gist ID
in your GitHub Gist.
Download:
Type
download
inVSCode Command Palette
.Enter your
GitHub Personal Access Token
(orleave it blank
if you want to download from a public Gist)Enter your
Gist ID
(or apublic Gist ID
).Done!
I did this on my Mac by copying VS Code's settings.json
to my iCloud drive for automatic backup, and then creating a symbolic link.
- Copy
settings.json
from VS code settings directory$HOME/Library/Application Support/Code/User/settings.json
to your backup location - Backup the old
settings.json
by renaming tosettings-old.json
- In the terminal,
cd
to VS code setting dir:cd ~/Library/Application\ Support/Code/User/
- Create the symlink to your backed up file using command
ln -sf path/to/backup/settings.json settings.json
. Since I backed mine up to iCloud and renamed the file tovscode.settings.json
, my command looked like this:ln -sf ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode.settings.json settings.json
- Check that you can open up user preferences in VS Code
To use the backup on a different Mac, just repeat steps 2-5.
I also did this for extensions...
cd ~/.vscode/
mkdir ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode/
cp -a extensions ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode
mv extensions extensions-old
ln -sf ~/Library/Mobile\ Documents/com~apple~CloudDocs/vscode/extensions extensions
User Settings
There is currently no automatic synchronization for user settings available in Visual Studio Code. On Windows the user settings are located in %APPDATA%\Code\User\settings.json
. You could save a copy of that file on OneDrive or Dropbox and move it on all your machines to the user settings folder. But this still includes manual steps on each machine every time you change the configuration.
You can suggest an automatic synchronization of settings here: https://visualstudio.uservoice.com/forums/293070-visual-studio-code
Workspace Settings
Add the .vscode
folder of your workspace to the version control system (Git/SVN etc). When you checkout the code from the repository you will automatically get the VS Code workspace settings.
I place my settings.json
in a configuration file that I sync with git (though Dropbox would also work) and use a Python script to symlink it to the correct location for each platform so updating it from the settings menu syncs across my machines. Creating symlinks requires admin privileges on Windows.
import os
import platform
# Find the settings file in the same directory as this script
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
VS_SETTINGS_SRC_PATH = os.path.join(SCRIPT_DIR, 'settings.json')
# https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations
if platform.system() == 'Windows':
VS_SETTINGS_DST_PATH = os.path.expandvars(r"%APPDATA%\Code\User\settings.json")
elif platform.system() == "Darwin":
VS_SETTINGS_DST_PATH = os.path.expandvars(r"$HOME/Library/Application Support/Code/User/settings.json")
elif platform.system() == "Linux":
raise NotImplementedError()
else:
raise NotImplementedError()
# On Windows, there might be a symlink pointing to a different file
# Always remove symlinks
if os.path.islink(VS_SETTINGS_DST_PATH):
os.remove(VS_SETTINGS_DST_PATH)
choice = input('symlink %r -> %r ? (y/n) ' % (VS_SETTINGS_SRC_PATH, VS_SETTINGS_DST_PATH))
if choice == 'y':
os.symlink(VS_SETTINGS_SRC_PATH, VS_SETTINGS_DST_PATH)
print('Done')
else:
print('aborted')
이를 수행하는 또 다른 방법은 GitHub의 리포지토리에 저장할 수있는 파일을 소프트 링크하는 것입니다. 예를 들어, Mac OS에서라는 디렉토리가 있다고 가정 해 보겠습니다 ~/dev/dotfiles/vscode
. 의이라고 거기에 두 개의 파일이 있다고 가정 해 봅시다 settings.json
와 keybindings.json
. 이러한 파일을 다음과 소프트 링크 할 수 있습니다.
ln -s ~/dev/dotfiles/vscode/keybindings.json ~/Library/Application\ Support/Code/User/keybindings.json
ln -s ~/dev/dotfiles/vscode/settings.json ~/Library/Application\ Support/Code/User/settings.json
Windows 또는 Linux를 사용하는 경우 각 설정 디렉토리의 경로는 https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations 에서 찾을 수 있습니다.
사용자 설정 대신 작업 공간 설정을 사용하십시오.
'programing tip' 카테고리의 다른 글
체스 프로그램을 개발할 때 주어진 값으로 아래 방향 배열을 초기화하는 것의 중요성은 무엇입니까? (0) | 2020.08.10 |
---|---|
"뚱뚱한"Cocoa Touch Framework를 내보내는 방법 (시뮬레이터 및 장치 용)? (0) | 2020.08.10 |
불변 클래스는 어떻게 만듭니 까? (0) | 2020.08.10 |
Func 란 무엇이며 언제 어떻게 사용합니까? (0) | 2020.08.09 |
Scala : 배열에 요소를 추가하는 가장 좋은 방법은 무엇입니까? (0) | 2020.08.09 |