Skip to content

Commit 63badf7

Browse files
pajomaclaude
andcommitted
fix(model): rename JournalPageType.attachement → attachment (#221)
Eliminates the domain model typo from enum definition, all consumers, method signature (injectAttachmentLinks), log strings, comments, and plan prose. grep -rn "attachement" src/ returns zero hits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cb8a516 commit 63badf7

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

docs/plans/2026-05-18-199-infer-type-context-object.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Trade-off: keeping the interface in `paths.ts` rather than `src/model/interfaces
1717

1818
`inferType` has no VS Code dependencies — safe to run inside Extension Host suite without special plumbing. Lock down all three classification branches before touching the signature:
1919

20-
- attachment: extension mismatch → `JournalPageType.attachement`
20+
- attachment: extension mismatch → `JournalPageType.attachment`
2121
- entry: `extension` matches AND name matches `/^[\d|\-|_]+$/``JournalPageType.entry`
2222
- note: `extension` matches AND name is alphanumeric → `JournalPageType.note`
2323

@@ -80,7 +80,7 @@ All existing tests plus the new unit tests must pass.
8080
## Test scenarios
8181

8282
- **Compile clean:** `npm run compile` and `npm run compile-tests` both exit 0, no TS errors
83-
- **Regressionattachment:** file with non-matching extension`JournalPageType.attachement`
83+
- **Regressionattachment:** file with non-matching extension`JournalPageType.attachment`
8484
- **Regressionentry:** matching extension + digits/dashes/underscores name`JournalPageType.entry`
8585
- **Regressionnote:** matching extension + alphanumeric name`JournalPageType.note`
8686
- **Regex fix verified:** `2026|05|18.md``JournalPageType.note` after Step 0b (pipe no longer in character class)

src/features/entries/scan-entries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class ScanEntries {
5454
}
5555

5656
// go into base directory, find all files changed within the last X days (see config)
57-
// for each file, check if it is an entry, a note or an attachement
57+
// for each file, check if it is an entry, a note or an attachment
5858
for (const directory of directories) {
5959
try {
6060
await this.fs.stat(directory.path);
@@ -89,7 +89,7 @@ export class ScanEntries {
8989
public async getPreviouslyAccessedFiles(thresholdInMs: number, callback: Function, picker: any, type: J.Model.JournalPageType, directories: Set<J.Model.ScopeDirectory>): Promise<void> {
9090

9191
// go into base directory, find all files changed within the last 40 days
92-
// for each file, check if it is an entry, a note or an attachement
92+
// for each file, check if it is an entry, a note or an attachment
9393

9494

9595
this.logger.trace("Entering getPreviouslyAccessedFiles() in actions/reader.ts and number of directories to scan: ", directories.size);

src/features/sync/sync-note-links.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export class SyncNoteLinks {
1818
*
1919
* @param doc
2020
*/
21-
public async injectAttachementLinks(doc: vscode.TextDocument, date: Date): Promise<vscode.TextDocument> {
22-
this.ctrl.logger.trace("Entering injectAttachementLinks() in features/sync-note-links for date: ", date);
21+
public async injectAttachmentLinks(doc: vscode.TextDocument, date: Date): Promise<vscode.TextDocument> {
22+
this.ctrl.logger.trace("Entering injectAttachmentLinks() in features/sync-note-links for date: ", date);
2323

2424
try {
2525
await this.ctrl.ui.saveDocument(doc);
@@ -33,12 +33,12 @@ export class SyncNoteLinks {
3333
const promises: Promise<J.Model.InlineString>[] = foundFiles
3434
.filter(file => J.Util.isNullOrUndefined(referencedFiles.find(match => match.fsPath === file.fsPath)))
3535
.map(file => {
36-
this.ctrl.logger.debug("injectAttachementLinks() - File link not present in entry: ", file);
36+
this.ctrl.logger.debug("injectAttachmentLinks() - File link not present in entry: ", file);
3737
return this.buildReference(doc, file);
3838
});
3939

4040
const inlineStrings = await Promise.all(promises);
41-
this.ctrl.logger.trace("injectAttachementLinks() - Number of references to synchronize: ", inlineStrings.length);
41+
this.ctrl.logger.trace("injectAttachmentLinks() - Number of references to synchronize: ", inlineStrings.length);
4242

4343
if (inlineStrings.length > 0) {
4444
this.ctrl.inject.injectInlineString(inlineStrings[0], ...inlineStrings.splice(1))

src/journal/paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export async function checkIfFileIsAccessible(path: string): Promise<void> {
176176
export function inferType(entry: Path.ParsedPath, extension: string): J.Model.JournalPageType {
177177

178178
if (!entry.ext.endsWith(extension)) {
179-
return J.Model.JournalPageType.attachement; // any attachement
179+
return J.Model.JournalPageType.attachment; // any attachment
180180
} else
181181

182182
// this is getting out of hand if we need to infer it by scanning the patterns from the settings.

src/model/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export enum JournalPageType {
22
note,
33
entry,
4-
attachement
4+
attachment
55
}
66

77
export interface ScopedTemplate {

src/vscode/dialogues.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ export class Dialogues {
126126
this.pickItem(JournalPageType.note).then(selected => {
127127
resolve(selected);
128128
});
129-
} else if (isNotNullOrUndefined(selected.pickItem) && selected.pickItem === JournalPageType.attachement) {
130-
this.pickItem(JournalPageType.attachement).then(selected => {
129+
} else if (isNotNullOrUndefined(selected.pickItem) && selected.pickItem === JournalPageType.attachment) {
130+
this.pickItem(JournalPageType.attachment).then(selected => {
131131
resolve(selected);
132132
});
133133
} else {
@@ -457,7 +457,7 @@ function addItemToPickList(entries: FileEntry[], input: TimedQuickPick, type: Jo
457457
else { displayName = `$(circle-large-filled) ${displayName}`; break; }
458458
}
459459
case JournalPageType.entry: displayName = `$(clock) ${displayName}`; break;
460-
case JournalPageType.attachement: displayName = `$(package) ${displayName}`; break;
460+
case JournalPageType.attachment: displayName = `$(package) ${displayName}`; break;
461461
}
462462

463463

src/vscode/startup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class Startup {
9898

9999
try {
100100
ctrl.reader.onNotesInjected = (doc, date) => {
101-
new J.Features.SyncNoteLinks(ctrl).injectAttachementLinks(doc, date)
101+
new J.Features.SyncNoteLinks(ctrl).injectAttachmentLinks(doc, date)
102102
.finally(() => ctrl.logger.trace("Scanning notes completed"));
103103
};
104104

0 commit comments

Comments
 (0)