/
toxblh
/
code-notes-infograph
Обзор
Документация
Войти
/
toxblh
/
code-notes-infograph
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/setup-code.py
99 строк
4 KB
Anton Palgunov
fix: ensure parent directory exists for settings file
08 фев 2026, 23:43
08 фев 2026, 23:43
c9ed8c1
Код
Авторство
О чём код?
#!/usr/bin/env python import os from pathlib import Path import json def настройка_экстеншнов(): нужные_расширения = ''' alefragnani.bookmarks anthonyattard.zoomer bierner.markdown-mermaid ms-python.debugpy ms-python.python oderwat.indent-rainbow telesoho.vscode-markdown-paste-image johnpapa.vscode-peacock bierner.markdown-image-size pomdtr.markdown-kroki '''.strip().split('\n') for рас in нужные_расширения: os.system(f'code-server --install-extension {рас}') def путь_к_user_settings(): профиль_кат = Path(путь_к_профилю) / "User" профиль_кат.mkdir(exist_ok=1, parents=1) настройки_путь = профиль_кат / "settings.json" return настройки_путь def настройки_code(путь_к_settings=Path(__file__).parent.parent.parent / '.vscode/settings.json'): путь_к_settings.parent.mkdir(parents=True, exist_ok=True) настр = json.loads(путь_к_settings.read_text()) if путь_к_settings.exists() else {} настр["editor.minimap.enabled"] = False настр["editor.unicodeHighlight.ambiguousCharacters"] = False настр["editor.fontFamily"] = "Consolas,monospace" настр["editor.fontFamily"] = "Consolas,monospace" настр["security.workspace.trust.untrustedFiles"] = "open" настр["editor.mouseWheelZoom"] = True настр["python.terminal.activateEnvironment"] = False настр["zoomer.zoomIncrement"] = 0.02 настр["markdown.editor.filePaste.enabled"] = "smart" настр["markdown.preview.markEditorSelection"] = False настр["markdown.preview.scrollEditorWithPreview"] = False настр["editor.pasteAs.enabled"] = True настр["editor.stickyScroll.enabled"] = False настр["markdown.preview.scrollPreviewWithEditor"] = False настр["markdown.editor.filePaste.copyIntoWorkspace"] = "mediaFiles" настр["markdown.copyFiles.destination"] = { "**/*.md": "pics/" } м = 'code-notes-infograph/css/code-notes.css' if not "markdown.styles" in настр: настр["markdown.styles"] = [] н = настр["markdown.styles"] if len(н) == 0 or н[0] != м: н.insert(0, м) # if not "regexrobin.rules" in настр: # настр["regexrobin.rules"] = [] # правила = настр["regexrobin.rules"] # нужные_правила = [ # { # "regex": r"""(`./)+([^\\n\\s]+)(`)""", # "link": r"""vscode-remote://file${fileDirname}/$2""", # "message": r"Open \u00ab${fileDirname}/$2\u00bb", # }, # { # "regex": r"""(`./)+([^\\\\n\\\\s]+)(`)""", # "link": r"""vscode-remote://file${fileDirname}/$2""", # "message": r"Open \u00ab${fileDirname}/$2\u00bb", # }, # ] # for нп in нужные_правила: # нп_ = { # "regex": нп['regex'], # "tree": {"group": "links"}, # "editor": [{ # "link": нп['link'], # "color": r"#3639EF", # "hoverMessage": нп['message'] # }] # } # нашли = False # for п in правила: # if п['regex'] == нп_['regex']: # п = нп_ # нашли = True # break # if not нашли: # правила.append(нп_) путь_к_settings.write_text(json.dumps(настр, indent=4, ensure_ascii=False)) настройка_экстеншнов() настройки_code()