microsoft / microsoft/vscode-isort

Template Sync: align importStrategy in typescript to python

Open
#591 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
106
Forks
29
Avg merge
1d 23h
Merged PRs (30d)
12

Description

### 🔄 Template Sync Required

Changes from the upstream [vscode-python-tools-extension-template](https://github.com/microsoft/vscode-python-tools-extension-template) have not yet been incorporated into this repository.

#### Source PR
- microsoft/vscode-python-tools-extension-template#158 — align importStrategy in typescript to python

#### Summary
The template PR updated the default value for `importStrategy` in `getGlobalSettings` from `'fromEnvironment'` to `'useBundled'`, aligning it with the package.json configuration default and the workspace-settings fallback. In vscode-isort, the `getWorkspaceSettings` function was already updated to `'useBundled'`, but `getGlobalSettings` still uses `'fromEnvironment'` as its hardcoded fallback.

While the practical impact is minimal (VS Code resolves the value from `package.json`'s `"default": "useBundled"` before reaching this fallback), the inconsistency can be confusing and could cause incorrect behavior in edge cases where configuration is absent.

#### Files with missing changes

- **`src/common/settings.ts`** — `getGlobalSettings` still returns `'fromEnvironment'` as the hardcoded default for `importStrategy`, while the template (and `getWorkspaceSettings` in this same file) uses `'useBundled'`.

```typescript
// Current (line ~197)
importStrategy: getGlobalValue(string)(config, 'importStrategy', 'fromEnvironment'),

// Template / expected
importStrategy: getGlobalValue(string)(config, 'importStrategy', 'useBundled'),
```

#### Suggested fix

Apply the following change to `src/common/settings.ts`:

```diff
- importStrategy: getGlobalValue(string)(config, 'importStrategy', 'fromEnvironment'),
+ importStrategy: getGlobalValue(string)(config, 'importStrategy', 'useBundled'),
```

This aligns the global-settings fallback with:
1. The `package.json` configuration default (`"default": "useBundled"`).
2. The `getWorkspaceSettings` fallback already present in this file.
3. The current template implementation.

#### Files skipped

All other files changed in template PR #158 (`package.json` default value) are already aligned in this repository.

---
🤖 This issue was auto-generated by the [`extension-template-sync`](.github/workflows/extension-template-sync.md) workflow.

> Generated by [Extension Template Sync](https://github.com/microsoft/vscode-isort/actions/runs/23092178431) · [◷](https://github.com/search?q=repo%3Amicrosoft%2Fvscode-isort+is%3Aissue+%22gh-aw-workflow-call-id%3A+microsoft%2Fvscode-isort%2FExtension+Template+Sync%22&type=issues)

Contributor guide

Open the contributing guide

Research direction

Open src/common/settings.ts and inspect getGlobalSettings alongside getWorkspaceSettings. Update the importStrategy fallback to match the package.json default and existing workspace fallback, then verify that the global fallback uses 'useBundled' and no other template-sync changes are missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.