You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed all failing CI tests by ensuring proper test independence and
correct usage of VS Code APIs. Tests now pass both individually and
when run as part of the full suite.
Key fixes:
- Fixed verify-auto-behavior.test.ts (5 failing tests)
* Tests were reading stale cached config values after .update()
* Solution: Get fresh config object after each update call
* Pattern: workspace.getConfiguration().update() then get NEW object
- Fixed import-organizer.test.ts command registration test
* Test expected extension to be activated but didn't trigger it
* Extension activates on 'onLanguage' events (opening TS/JS files)
* Solution: Create temp TS document + explicitly wait for activation
* Test now works when run alone AND with full suite
- Ensured all tests are independent and order-agnostic
* Each test can run in isolation without depending on others
* Proper use of setup/teardown for state management
* No shared state between test runs
Test results:
- Before: 345 passing, 5 failing in CI
- After: 350 passing (all tests green)
docs: Improve README by softening limitations sections
Reorganized and toned down documentation about extension limitations
to avoid frightening users with prominent warnings about edge cases.
Changes:
- Removed scary '⚠️ Known Limitations' section from top of Usage
- Removed duplicate 'Comment Preservation' section
- Created new 'Notes' section near end (before Credits)
- Softened wording throughout - informative but not dramatic
- Focus on what works first, mention limitations matter-of-factly
- Merged comment handling and legacy mode notes together
The new approach presents limitations as minor notes rather than
major problems, which better reflects reality (inline comment
preservation is rare and low-value, legacy mode quirks only
affect migrated users who need backward compatibility).
**Why not preserved?** This is NOT a parser limitation - the parsers provide comment ranges. We simply haven't implemented inline comment preservation due to significant complexity, tricky edge cases, and low benefit. This is shared behavior with the original TypeScript Hero extension. If this is a blocker for you, please [open an issue](https://github.com/angular-schule/mini-typescript-hero/issues) with your use case.
160
-
161
-
**Example:**
162
-
```typescript
163
-
// This comment IS preserved (leading comment)
164
-
import { Foo } from'./foo'; // This IS preserved (trailing comment)
165
-
166
-
// This comment IS preserved (between imports)
167
-
import { Bar } from'./bar';
168
-
169
-
// This is NOT preserved (inside braces):
170
-
import { Baz/* LOST */ } from'./baz';
171
-
```
172
145
173
146
### Toggle Legacy Mode
174
147
@@ -234,22 +207,51 @@ If you've never used TypeScript Hero before, the migration simply won't run —
234
207
235
208
**Mini TypeScript Hero respects your existing editor configuration!** Instead of requiring duplicate configuration, the extension follows this priority order:
- Used when VSCode preferences are set to `"auto"` or `"ignore"`, or when `useOnlyExtensionSettings: true`
242
+
#### Override: useOnlyExtensionSettings
247
243
248
-
**Why this order?** It matches how other formatters work, preventing configuration conflicts and ensuring consistency across your entire project.
244
+
Set `miniTypescriptHero.imports.useOnlyExtensionSettings: true` to skip Priority 1 entirely:
249
245
250
-
**Override:** Set `miniTypescriptHero.imports.useOnlyExtensionSettings: true` to ignore VS Code settings and use only extension-specific settings. Useful for enforcing consistent import formatting across all team members regardless of their editor configuration.
246
+
| Setting | When `useOnlyExtensionSettings: false` (default) | When `useOnlyExtensionSettings: true`|
|**Quote Style**| VS Code setting → Extension setting | Extension setting only |
249
+
|**Semicolons**| VS Code setting → Extension setting | Extension setting only |
250
+
|**Indentation**| VS Code setting → Extension setting | Extension setting only |
251
251
252
-
**Note on EditorConfig:** For indentation (`tabSize` and `insertSpaces`), if you have the [EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) installed, VS Code automatically applies `.editorconfig` settings to `editor.tabSize` and `editor.insertSpaces`. Our extension reads these resolved VS Code values, so EditorConfig integration works automatically for indentation.
252
+
**Use case:** Enforce consistent import formatting across all team members regardless of their personal VS Code configuration.
253
+
254
+
**Note on EditorConfig:** For indentation (`tabSize` and `insertSpaces`), if you have the [EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) installed, VS Code automatically applies `.editorconfig` settings to `editor.tabSize` and `editor.insertSpaces`. Our extension reads these resolved VS Code values, so EditorConfig integration works automatically for indentation (but NOT for quotes - use VS Code settings for quotes).
253
255
254
256
#### Example Scenarios
255
257
@@ -536,6 +538,41 @@ Command activation is automatic in VS Code 1.74+ via `contributes.commands`. We
536
538
537
539
**This extension does not collect any telemetry or user data.** Your code, settings, and usage patterns remain completely private. We respect your privacy and believe in keeping your development environment local and secure.
538
540
541
+
## Notes
542
+
543
+
### Comment Handling
544
+
545
+
The extension preserves most comments in your import blocks:
- Comments between individual specifiers in multiline imports
555
+
556
+
```typescript
557
+
// ✅ This comment is preserved
558
+
import { Foo } from'./foo'; // ✅ This too
559
+
560
+
// ❌ This is lost:
561
+
import { Bar/* inline comment */ } from'./bar';
562
+
```
563
+
564
+
This matches the behavior of the original TypeScript Hero extension. Inline comment preservation adds significant complexity for limited real-world benefit. If you rely on inline comments within imports, please [share your use case](https://github.com/angular-schule/mini-typescript-hero/issues).
565
+
566
+
### Legacy Mode Notes
567
+
568
+
When `legacyMode: true` (automatically enabled for migrated users), some settings behave differently to maintain compatibility with the original TypeScript Hero:
-`organizeSortsByFirstSpecifier` — Always sorts by library name (setting has no effect)
572
+
-`disableImportsSorting` — Always sorts imports (setting has no effect)
573
+
574
+
This ensures consistent output for users migrating from the original extension. New users get `legacyMode: false` by default for modern, fully-functional behavior. You can toggle this setting anytime via the command palette.
575
+
539
576
## Credits
540
577
541
578
This extension is based on the "Organize Imports" feature from [TypeScript Hero](https://github.com/buehler/typescript-hero) by Christoph Bühler. The original TypeScript Hero is no longer maintained, so we've extracted and modernized this valuable feature into a standalone extension.
0 commit comments