Add vscode settings to init files
This commit is contained in:
parent
6e09489826
commit
f5f1e85ce0
3 changed files with 79 additions and 13 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -18,5 +18,8 @@
|
||||||
.config/deluge/ssl/
|
.config/deluge/ssl/
|
||||||
.config/deluge/deluged.log
|
.config/deluge/deluged.log
|
||||||
.config/deluge/deluged.pid
|
.config/deluge/deluged.pid
|
||||||
|
.DS_Store
|
||||||
.ipython/profile_default/history.sqlite
|
.ipython/profile_default/history.sqlite
|
||||||
_viminfo
|
_viminfo
|
||||||
|
vscode/workspaceStorage
|
||||||
|
vscode/globalStorage
|
||||||
|
|
|
||||||
65
setup.py
65
setup.py
|
|
@ -1,13 +1,21 @@
|
||||||
#!/usr/local/bin/python3
|
#!/usr/local/bin/python3
|
||||||
import os
|
import os
|
||||||
|
|
||||||
ignore = {'setup.cmd', 'setup.py', 'setup.ps1', 'readme.md', '.git'}
|
ignore = {
|
||||||
|
"setup.cmd",
|
||||||
|
"setup.py",
|
||||||
|
"setup.ps1",
|
||||||
|
"readme.md",
|
||||||
|
".git",
|
||||||
|
"vscode",
|
||||||
|
".DS_Store",
|
||||||
|
}
|
||||||
|
|
||||||
home = os.path.expanduser('~')
|
|
||||||
source_files = [file for file in os.listdir(os.getcwd()) if file not in ignore]
|
def link_helper(source, dst):
|
||||||
for source in source_files:
|
"""A little helper to symlink source to destination, that prints a warning
|
||||||
source = os.path.abspath(source)
|
if the destination exists and is not a link into our Init-Files repository.
|
||||||
dst = os.path.join(home, os.path.split(source)[1])
|
"""
|
||||||
if os.path.exists(dst):
|
if os.path.exists(dst):
|
||||||
if os.path.islink(dst):
|
if os.path.islink(dst):
|
||||||
other_src = os.readlink(dst)
|
other_src = os.readlink(dst)
|
||||||
|
|
@ -16,12 +24,45 @@ for source in source_files:
|
||||||
if other_src != source:
|
if other_src != source:
|
||||||
print(source)
|
print(source)
|
||||||
print(
|
print(
|
||||||
'WARNING: {} is symlink but not into '
|
"WARNING: {} is symlink but not into "
|
||||||
'Init-Files (it links to {})'.format(dst, other_src)
|
"Init-Files (it links to {})".format(dst, other_src)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print('WARNING: {} already exists and is not a symlink'.format(dst))
|
print("WARNING: {} already exists and is not a symlink".format(dst))
|
||||||
continue
|
else:
|
||||||
|
print("Linking: {} -> {}".format(source, dst))
|
||||||
|
os.symlink(source, dst)
|
||||||
|
|
||||||
print('Linking: {} -> {}'.format(source, dst))
|
|
||||||
os.symlink(source, dst)
|
home = os.path.expanduser("~")
|
||||||
|
source_files = [file for file in os.listdir(os.getcwd()) if file not in ignore]
|
||||||
|
for source in source_files:
|
||||||
|
source = os.path.abspath(source)
|
||||||
|
dst = os.path.join(home, os.path.split(source)[1])
|
||||||
|
link_helper(source, dst)
|
||||||
|
|
||||||
|
# VS Code goes somewhere else, not in the home directory. It depends on the
|
||||||
|
# platform and it also has this VS Code @ FB thing, yikes. So here are the
|
||||||
|
# roots, in the order that we're going to prefer them.
|
||||||
|
vscode_source = os.path.abspath("vscode")
|
||||||
|
possible_vscode_roots = [
|
||||||
|
os.path.join(home, "Library", "Application Support"), # MacOS X
|
||||||
|
os.getenv("APPDATA"), # Windows
|
||||||
|
os.path.join(home, ".config"), # Everywhere
|
||||||
|
]
|
||||||
|
existing_vscode_roots = [
|
||||||
|
root for root in possible_vscode_roots if root and os.path.exists(root)
|
||||||
|
]
|
||||||
|
if existing_vscode_roots:
|
||||||
|
vscode_root = existing_vscode_roots[0]
|
||||||
|
for variant in ["Code", "VS Code @ FB"]:
|
||||||
|
dst_root = os.path.join(vscode_root, variant)
|
||||||
|
if not os.path.exists(dst_root):
|
||||||
|
os.mkdir(dst_root)
|
||||||
|
link_helper(vscode_source, os.path.join(dst_root, "User"))
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
"WARNING: No viable root for VS Code config (tried {})".format(
|
||||||
|
possible_vscode_roots
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
||||||
22
vscode/settings.json
Normal file
22
vscode/settings.json
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"breadcrumbs.enabled": true,
|
||||||
|
"editor.rulers": [
|
||||||
|
80
|
||||||
|
],
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.minimap.enabled": false,
|
||||||
|
"git.enableSmartCommit": true,
|
||||||
|
"clang-format.fallbackStyle": "llvm",
|
||||||
|
"fb.remote-connections.hosts": [
|
||||||
|
{
|
||||||
|
"hostname": "our.doty.sb.facebook.com",
|
||||||
|
"folders": [
|
||||||
|
"/data/users/doty/fbsource/fbcode/"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
|
||||||
|
"editor.fontSize": 14,
|
||||||
|
"editor.fontLigatures": true,
|
||||||
|
"editor.formatOnSaveTimeout": 1500,
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue