aboutsummaryrefslogtreecommitdiff
path: root/pw_ide
diff options
context:
space:
mode:
authorChad Norvell <chadnorvell@google.com>2024-01-29 20:20:52 +0000
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-01-29 20:20:52 +0000
commit76c3f705fb7e8f295140136bfd33d1a2d32977aa (patch)
treea96f5ae614ad611769d6d5036b131a1b6ada9806 /pw_ide
parentfc28a56edc7d71c8661f9e6fe34f914228bab730 (diff)
downloadpigweed-76c3f705fb7e8f295140136bfd33d1a2d32977aa.tar.gz
pw_ide: Remove terminal env vars from VSC settings
As of pwrev.dev/187195, an activated terminal can be created through a VSC command, which ensures that the activation env vars are always up-to-date. So we no longer need to populate them in `settings.json` (and risk them going stale). Change-Id: Iceccef46bc79a6381515afafd4e995c63551ed7c Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/188470 Commit-Queue: Chad Norvell <chadnorvell@google.com> Reviewed-by: Keir Mierle <keir@google.com>
Diffstat (limited to 'pw_ide')
-rw-r--r--pw_ide/py/pw_ide/vscode.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/pw_ide/py/pw_ide/vscode.py b/pw_ide/py/pw_ide/vscode.py
index 57adbf761..4990867a6 100644
--- a/pw_ide/py/pw_ide/vscode.py
+++ b/pw_ide/py/pw_ide/vscode.py
@@ -61,17 +61,14 @@ command.
# TODO(chadnorvell): Import collections.OrderedDict when we don't need to
# support Python 3.8 anymore.
from enum import Enum
-import json
import os
from pathlib import Path
-import platform
import shutil
import subprocess
from typing import Any, Dict, List, Optional, OrderedDict
from pw_cli.env import pigweed_environment
-from pw_ide.activate import BashShellModifier
from pw_ide.cpp import ClangdSettings, CppIdeFeaturesState
from pw_ide.editors import (
@@ -87,40 +84,6 @@ from pw_ide.settings import PigweedIdeSettings
env = pigweed_environment()
-def _vsc_os(system: str = platform.system()):
- """Return the OS tag that VSC expects."""
- if system == 'Darwin':
- return 'osx'
-
- return system.lower()
-
-
-def _activated_env() -> OrderedDict[str, Any]:
- """Return the environment diff needed to provide Pigweed activation.
-
- The integrated terminal will already include the user's default environment
- (e.g. from their shell init scripts). This provides the modifications to
- the environment needed for Pigweed activation.
- """
- # Not all environments have an actions.json, which this ultimately relies
- # on (e.g. tests in CI). No problem, just return an empty dict instead.
- try:
- activated_env = (
- BashShellModifier(env_only=True, path_var='${env:PATH}')
- .modify_env()
- .env_mod
- )
- except (FileNotFoundError, json.JSONDecodeError):
- activated_env = dict()
-
- return OrderedDict(activated_env)
-
-
-def _local_terminal_integrated_env() -> Dict[str, Any]:
- """VSC setting to activate the integrated terminal."""
- return {f'terminal.integrated.env.{_vsc_os()}': _activated_env()}
-
-
def _local_clangd_settings(ide_settings: PigweedIdeSettings) -> Dict[str, Any]:
"""VSC settings for running clangd with Pigweed paths."""
clangd_settings = ClangdSettings(ide_settings)
@@ -355,7 +318,6 @@ def _default_settings(
return OrderedDict(
{
**_DEFAULT_SETTINGS,
- **_local_terminal_integrated_env(),
**_local_clangd_settings(pw_ide_settings),
**_local_python_settings(),
}