Skip to content

Commit 49193aa

Browse files
committed
feat: enhance formatting function to add blank lines between last import and first non-import declaration
1 parent 5cc4499 commit 49193aa

2 files changed

Lines changed: 38 additions & 5 deletions

File tree

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ All modules can be toggled independently via the extension preferences.
2626

2727
## Installation
2828

29+
### From extensions.gnome.org (Recommended)
30+
31+
The easiest way to install is from the official GNOME Extensions website.
32+
33+
<a href="https://extensions.gnome.org/extension/9389/aurora-shell/">
34+
<img src="https://github.com/andyholmes/gnome-shell-extensions-badge/raw/master/get-it-on-ego.svg" alt="Get it on EGO" width="200" />
35+
</a>
36+
37+
### From command-line
38+
2939
```bash
3040
git clone https://github.com/luminusOS/aurora-shell.git
3141
cd aurora-shell
@@ -80,16 +90,29 @@ export class MyModule extends Module {
8090
}
8191
```
8292

83-
2. Register in `src/registry.ts`:
93+
2. Add an entry to `MODULE_REGISTRY` in `src/registry.ts`:
94+
95+
```typescript
96+
{
97+
key: 'myModule',
98+
settingsKey: 'module-my-module',
99+
title: 'My Module',
100+
subtitle: 'Description',
101+
},
102+
```
103+
104+
3. Add the import and factory to `MODULE_FACTORIES` in `src/extension.ts`:
84105

85106
```typescript
86-
import { MyModule } from './modules/myModule.ts';
107+
import { MyModule } from "./modules/myModule.ts";
87108

88-
// Add to MODULE_REGISTRY:
89-
{ key: 'myModule', settingsKey: 'module-my-module', create: () => new MyModule(), title: 'My Module', subtitle: 'Description' },
109+
const MODULE_FACTORIES: Record<string, () => Module> = {
110+
// ...existing entries...
111+
myModule: () => new MyModule(),
112+
};
90113
```
91114

92-
3. Add key to `schemas/org.gnome.shell.extensions.aurora-shell.gschema.xml`:
115+
4. Add the key to `schemas/org.gnome.shell.extensions.aurora-shell.gschema.xml`:
93116

94117
```xml
95118
<key name="module-my-module" type="b">

build/formatting.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ export function addBlankLinesBetweenMembers(code: string): string {
6565
needsBlank = true;
6666
}
6767

68+
// Between last import and first non-import declaration
69+
if (
70+
!needsBlank &&
71+
prevIndent === 0 &&
72+
prevTrimmed.startsWith('import ') &&
73+
!currTrimmed.startsWith('import ')
74+
) {
75+
needsBlank = true;
76+
}
77+
6878
if (needsBlank) {
6979
result.push('');
7080
}

0 commit comments

Comments
 (0)