diff --git a/.github/workflows/installation.yml b/.github/workflows/installation.yml index 2ff62bc..6be384d 100644 --- a/.github/workflows/installation.yml +++ b/.github/workflows/installation.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} - - name: Set up Python + - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fd6504..336b22a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log + +# 0.2.0 +- `Select Environment` actions now update the run environment instead of base. +- Modified status bar to show both environments, i.e.`base + local`, and `base` is no longer selectable. + # 0.1.0 - Expanded pipeline discovery to support `*pipeline*.py` patterns and improved handling of nested subdirectories. - Add new extension setting `Kedro: Environment` to change the configuration environment. diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 4543f11..c7b71e8 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -115,21 +115,20 @@ def _set_project_with_workspace(self): context = session.load_context() config_loader: OmegaConfigLoader = context.config_loader # context.env is set when KEDRO_ENV or kedro run --env is set - conf_env = context.env if context.env else config_loader.base_env - base_path = str(Path(config_loader.conf_source) / conf_env) + run_env = context.env if context.env else config_loader.default_run_env except RuntimeError as e: log_for_lsp_debug(str(e)) project_metadata = None context = None config_loader = None - base_path = None + run_env = None finally: self.project_metadata = project_metadata self.context = context self.config_loader = config_loader self.dummy_catalog = self._get_dummy_catalog() - self.base_path = base_path + self.run_env = run_env def _get_dummy_catalog(self): # '**/catalog*' reads modular pipeline configs @@ -196,10 +195,11 @@ def _get_conf_paths(server: KedroLanguageServer, key): A set of configuration paths. """ - config_loader: OmegaConfigLoader = LSP_SERVER.config_loader + config_loader: OmegaConfigLoader = server.config_loader patterns = config_loader.config_patterns.get(key, []) - default_run_env = str( - Path(config_loader.conf_source) / config_loader.default_run_env + # By default is local + run_env = str( + Path(config_loader.conf_source) / server.run_env ) base_env = str(Path(config_loader.conf_source) / config_loader.base_env) @@ -209,7 +209,7 @@ def _get_conf_paths(server: KedroLanguageServer, key): # That is, if a config is found in both environment, the LSP should return the default_run_env one. # The LSP start searching in default_run_env first, if there is match it will end eagerly. - for base_path in [default_run_env, base_env]: + for base_path in [run_env, base_env]: tmp_paths = [] for pattern in patterns: for each in config_loader._fs.glob( diff --git a/src/common/commands.ts b/src/common/commands.ts index 01229cf..76ec172 100644 --- a/src/common/commands.ts +++ b/src/common/commands.ts @@ -14,10 +14,10 @@ export async function selectEnvironment() { .filter((dirent) => dirent.isDirectory()) .map((dirent) => dirent.name); - const envs: QuickPickItem[] = directories.map((label) => ({ label })); + const envs: QuickPickItem[] = directories.filter(dir => dir !== 'base').map((label) => ({ label })); const result = await window.showQuickPick(envs, { - placeHolder: 'Select Kedro base environment', + placeHolder: 'Select Kedro runtime environment', }); return result; diff --git a/src/common/status_bar.ts b/src/common/status_bar.ts index c52ed41..21b16c6 100644 --- a/src/common/status_bar.ts +++ b/src/common/status_bar.ts @@ -4,20 +4,20 @@ import { } from './settings'; import { getProjectRoot } from './utilities'; -export async function createStatusBar(commandName: string, serverId:string): Promise{ +export async function createStatusBar(commandName: string, serverId: string): Promise { // Create a status bar item const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); statusBarItem.command = commandName; // https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration const projectRoot = await getProjectRoot(); const workspaceSetting = await getWorkspaceSettings(serverId, projectRoot, true); - let environment = 'base'; // todo: Assume base, better to take this from server as it could be changed in project settings. + let environment = 'local'; if (workspaceSetting.environment) { - environment = workspaceSetting.environment; + environment = workspaceSetting.environment; } - statusBarItem.text = `$(kedro-logo) ${environment}`; + statusBarItem.text = `$(kedro-logo) base + ${environment}`; statusBarItem.show(); return statusBarItem; }