tis-vscode-config icon

VSCode Configuration

Paquet d'installation silencieuse pour VSCode Configuration

0.2.5-14
Development
Development

  • package: tis-vscode-config
  • name: VSCode Configuration
  • version: 0.2.5-14
  • categories: Development
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • locale: all
  • target_os: all
  • architecture: all
  • signature_date:
  • size: 7.20 Ko
  • depends:
  • conflicts :

package           : tis-vscode-config
version           : 0.2.5-14
architecture      : all
section           : base
priority          : optional
name              : VSCode Configuration
categories        : Development
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : Configure Visual Studio Code
depends           : tis-vscode-pylance
conflicts         : tis-config-vscode
maturity          : PROD
locale            : all
target_os         : all
min_wapt_version  : 2.3
sources           : https://code.visualstudio.com/Download
installed_size    : 
impacted_process  : 
description_fr    : Configuration de Visual Studio Code
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : c29d5d91-02ce-450d-b5b0-cd8c2395ce6e
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2024-12-20T14:00:09.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : wODjUevt+vz2do5Fjr2aiwDfBSp2sNF61lCDaaJMauoaORON/FKWVAQ75WzD7jORb1DuTkJgyshN22yQlpByFVB0LxR95phfMK07XnybJJq8kPSrZ5FtES7cV3Z+VPkFMjYJG2GhFf8NN7pCC7B6tsmJnf9y4ZPli+s1mK1IU9EmPrSH/Md5yyQ0F+nJBjsHjE/4/e7h9oir0s4R5jplWsIClOE6+b4T+wibK1I799wv03pbDRp/r+PawaEm43210nx058QLwkdRGAQpTudpD9pnYrFs88ULGdFmnKyMsiaxOID7XxV490euAg0QC+bqbyHZx/murVAtJRWoF4kwEA==

# -*- coding: utf-8 -*-
from setuphelpers import *
import json

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

Configuration procedure: https://supunkavinda.blog/vscode-editing-settings-json

File -> Preferences -> Settings -> Extensions -> Scroll down and find "Edit in settings.json"

Or in these paths in your OS :
Windows : %APPDATA%\Code\User\settings.json
macOS   : $HOME/Library/Application Support/Code/User/settings.json
Linux   : $HOME/.config/Code/User/settings.json

https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions

"""


def install():
    pass


def session_setup():
    print("Applying: VSCode configuration")

    # Initializing variables
    if get_os_name() == "Windows":
        user_conf_dir = makepath(user_appdata, "Code", "User")
    elif get_os_name() == "Linux":
        user_conf_dir = makepath(user_home_directory(), ".config", "Code", "User")
    elif get_os_name() == "Darwin":
        user_conf_dir = makepath(user_home_directory(), "Library", "Application Support", "Code", "User")

    user_conf_file = makepath(user_conf_dir, "settings.json")
    user_conf_content = r"""{

    "update.mode": "none",
    "update.enableWindowsBackgroundUpdates": false,
    "update.showReleaseNotes": false,
    "powershell.promptToUpdatePowerShell": false,
    "extensions.autoCheckUpdates": false,
    "extensions.autoUpdate": false,
    "extensions.ignoreRecommendations": true,

    "telemetry.telemetryLevel": "off",
    "redhat.telemetry.enabled": false,
    "npm.fetchOnlinePackageInfo": false,
    "json.schemaDownload.enable": false,

    "editor.wordWrap": "on",
    "editor.minimap.enabled": false,
    "workbench.activityBar.visible": true,
    "workbench.startupEditor": "none",
    "restructuredtext.preview.scrollEditorWithPreview": false,
    "restructuredtext.preview.scrollPreviewWithEditor": false,
    "markdown.preview.scrollEditorWithPreview": false,
    "markdown.preview.scrollPreviewWithEditor": false,

    "files.autoSave": "afterDelay",

    "git.openRepositoryInParentFolders": "always",
    "git.autofetch": true,

    "files.associations": {
        "control": "yaml"
    }

}"""

    user_conf_data = json.loads(user_conf_content)
    if isfile(user_conf_file):
        user_conf_data = json_load_file(user_conf_file)
    mkdirs(user_conf_dir)

    print("Updating: %s" % user_conf_file)
    user_conf_data.update(json.loads(user_conf_content))

    user_conf_data.pop("python.formatting.blackPath", None)
    user_conf_data.pop("python.formatting.provider", None)
    user_conf_data.pop("python.formatting.blackArgs", None)
    user_conf_data.pop("python.formatting.blackPath", None)
    user_conf_data.pop("python.languageServer", None)

    json_write_file(user_conf_file, user_conf_data)


def json_load_file(json_file, encoding="utf-8"):
    r"""Get content of a json file

    Args:
        path (str): path to the file

    Returns:
        dictionary (dict)

    """
    with open(json_file, encoding=encoding) as read_file:
        return json.load(read_file, cls=TrailingCommaJSONDecoder)


class TrailingCommaJSONDecoder(json.JSONDecoder):
    def decode(self, s, *args, **kwargs):
        # Remove trailing commas before decoding
        s = self._remove_trailing_commas(s)
        return super().decode(s, *args, **kwargs)

    def _remove_trailing_commas(self, s):
        # A simple implementation to remove trailing commas
        # This might not handle all edge cases, but it works for most common cases
        return s.replace(",}", "}").replace(",]", "]")

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
763499011c813be9ea4fa9f860e94d53ed8b4786a336bbfff0aabdc4d1b05625 : WAPT/changelog.txt
d200d77e41291739e7cec0aaf22294dcf4a6ee5ef69452036d592c5fc08d8935 : WAPT/control
7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2 : WAPT/icon.png
e84673b467ca9e129324d8f2d8642a947fbfd58b24234f395a1f8373a854c7d7 : luti.json
7bba7b5fab379827b97e7b05bd50c68826b67f02c8d9f973493c6641d40bb3c8 : setup.py

0.2.5-11
===
tis-waptpython-black is now a tis-waptdev-package-tools dependency
Using TrailingCommaJSONDecoder to make sure config will be applied
Fix "del"


0.2.4-8
===
No longer use PyLance as it uses too much memory (https://github.com/microsoft/pylance-release/issues/4121#issuecomment-1534371617)
Re-adding telemetry and update disabling
Adding some git options
Handle dirty JSON
Define control as YAML file since it makes it more readable