diff --git a/src/app/container.ts b/src/app/container.ts index b3a8de4..a97df3f 100644 --- a/src/app/container.ts +++ b/src/app/container.ts @@ -19,14 +19,17 @@ 'use strict'; import * as vscode from 'vscode'; -import { IConfiguration, IFileSystem, ILogger, IWorkspaceConfigReader, JournalController } from '../model'; -import { Configuration } from '../vscode/conf'; -import { Parser } from '../journal/parser'; -import { Writer } from '../journal/writer'; -import { Reader } from '../journal/reader'; -import { Inject } from '../journal/inject'; -import { Dialogues } from '../vscode/dialogues'; -import { VscodeFileSystem } from '../vscode/vscode-fs'; +import { IConfiguration, IFileSystem, ILogger, IWorkspaceConfigReader, JournalController } from '../shared/model/index'; +import { Configuration } from '../shared/config/configuration'; +import { Parser } from '../features/smart-input/parser'; +import { Writer } from '../features/entries/writer'; +import { Reader } from '../features/entries/reader'; +import { Inject } from '../features/entries/inject'; +import { Dialogues } from '../features/smart-input/dialogues'; +import { VscodeFileSystem } from '../shared/fs/vscode-fs'; +import { JournalEvents } from '../shared/events'; +import { getWeekFromURIAndConfig } from '../shared/paths'; +import { SyncDailyLinks } from '../features/weekly/sync-daily-links'; /** * Builds the logger once the configuration is available. The logger needs the @@ -51,6 +54,7 @@ export class Container implements JournalController { public readonly ui: Dialogues; public readonly writer: Writer; public readonly reader: Reader; + public readonly events: JournalEvents; constructor(configSource: IWorkspaceConfigReader, loggerFactory: LoggerFactory) { this.config = new Configuration(configSource); @@ -62,5 +66,25 @@ export class Container implements JournalController { this.writer = new Writer(this.config, this.logger, this.inject, this.fs, async (path) => vscode.workspace.openTextDocument(vscode.Uri.file(path))); this.reader = new Reader(this.config, this.logger, this.writer, this.ui, this.fs); + this.events = new JournalEvents(); + + // Cross-feature: when an entry opens, the weekly feature refreshes its + // daily-entry links. Wired here (composition root) so the entries + // feature need not import the weekly feature. + this.events.onEntryOpened(({ doc }) => this.syncWeeklyOnEntryOpened(doc)); + } + + private syncWeeklyOnEntryOpened(doc: vscode.TextDocument): void { + // Fire-and-forget — must never reject the open flow. + getWeekFromURIAndConfig(doc.uri, this.config) + .then(weekInfo => { + if (weekInfo && this.config.getWeeklySyncConfig().enabled) { + const scopeId = weekInfo.scope === 'default' ? undefined : weekInfo.scope; + new SyncDailyLinks(this) + .sync(doc, weekInfo.week, weekInfo.year, scopeId) + .catch(err => this.logger.error("entryOpened weekly sync failed:", err)); + } + }) + .catch(err => this.logger.error("entryOpened getWeekFromURIAndConfig failed:", err)); } } diff --git a/src/app/register.ts b/src/app/register.ts index cace912..4df4be1 100644 --- a/src/app/register.ts +++ b/src/app/register.ts @@ -20,14 +20,23 @@ import * as vscode from 'vscode'; import { Container } from './container'; -import { - OpenJournalWorkspaceCommand, OpenNextEntryCommand, OpenPreviousEntryCommand, - PrintDurationCommand, PrintSumCommand, PrintTimeCommand, ShiftTaskCommand, - ShowEntryForInputCommand, ShowEntryForTodayCommand, ShowEntryForTomorrowCommand, - ShowEntryForYesterdayCommand, ShowNoteCommand, -} from '../commands'; -import { SyncDailyLinks, SyncNoteLinks, WeeklyEntryWatcher } from '../features'; -import { CompletedTaskActions, OpenTaskActions } from '../ui'; +import { OpenJournalWorkspaceCommand } from '../features/tools/commands/open-journal-workspace'; +import { PrintTimeCommand } from '../features/tools/commands/print-current-time'; +import { PrintDurationCommand } from '../features/tools/commands/print-duration-between-selected-times'; +import { PrintSumCommand } from '../features/tools/commands/print-sum-of-selected-numbers'; +import { CopyTaskCommand as ShiftTaskCommand } from '../features/tasks/commands/copy-task'; +import { OpenNextEntryCommand } from '../features/navigation/commands/open-next-entry'; +import { OpenPreviousEntryCommand } from '../features/navigation/commands/open-previous-entry'; +import { ShowEntryForInputCommand } from '../features/entries/commands/show-entry-for-input'; +import { ShowEntryForTodayCommand } from '../features/entries/commands/show-entry-for-today'; +import { ShowEntryForTomorrowCommand } from '../features/entries/commands/show-entry-for-tomorrow'; +import { ShowEntryForYesterdayCommand } from '../features/entries/commands/show-entry-for-yesterday'; +import { ShowNoteCommand } from '../features/notes/commands/show-note'; +import { WeeklyEntryWatcher } from '../features/weekly/weekly-entry-watcher'; +import { SyncDailyLinks } from '../features/weekly/sync-daily-links'; +import { SyncNoteLinks } from '../features/notes/sync-note-links'; +import { CompletedTaskActions } from '../features/tasks/codeactions/for-completed-tasks'; +import { OpenTaskActions } from '../features/tasks/codeactions/for-open-tasks'; const MARKDOWN_SELECTOR: vscode.DocumentSelector = { scheme: 'file', language: 'markdown' }; diff --git a/src/app/startup.ts b/src/app/startup.ts index b87a86c..66f5cff 100644 --- a/src/app/startup.ts +++ b/src/app/startup.ts @@ -20,8 +20,8 @@ import * as vscode from 'vscode'; import * as Path from 'path'; -import { isNullOrUndefined, ConsoleLogger } from '../util'; -import { Configuration } from '../vscode/conf'; +import { isNullOrUndefined, ConsoleLogger } from '../shared/index'; +import { Configuration } from '../shared/config/configuration'; import { Container } from './container'; import { registerCacheInvalidation, registerCodeActions, registerCommands } from './register'; diff --git a/src/commands/index.ts b/src/commands/index.ts deleted file mode 100644 index 8be03da..0000000 --- a/src/commands/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export { CopyTaskCommand as ShiftTaskCommand } from './copy-task'; -export { OpenJournalWorkspaceCommand } from './open-journal-workspace'; -export { PrintTimeCommand } from './print-current-time'; -export { PrintDurationCommand } from './print-duration-between-selected-times'; -export { PrintSumCommand } from './print-sum-of-selected-numbers'; -export { ShowEntryForInputCommand } from './show-entry-for-input'; -export { ShowEntryForTodayCommand } from './show-entry-for-today'; -export { ShowEntryForTomorrowCommand } from './show-entry-for-tomorrow'; -export { ShowEntryForYesterdayCommand } from './show-entry-for-yesterday'; -export { ShowNoteCommand } from './show-note'; -export { OpenPreviousEntryCommand } from './open-previous-entry'; -export { OpenNextEntryCommand } from './open-next-entry'; \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index baf9eae..c3acc07 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -20,8 +20,8 @@ import * as vscode from 'vscode'; -import { Configuration } from './vscode'; -import { Startup } from './app'; +import { Configuration } from './shared/config/configuration'; +import { Startup } from './app/index'; export var journalStartup: Startup; export var journalConfiguration: Configuration; diff --git a/src/commands/show-entry-for-date.ts b/src/features/entries/commands/show-entry-for-date.ts similarity index 80% rename from src/commands/show-entry-for-date.ts rename to src/features/entries/commands/show-entry-for-date.ts index 0ab9a19..62e52a7 100644 --- a/src/commands/show-entry-for-date.ts +++ b/src/features/entries/commands/show-entry-for-date.ts @@ -18,11 +18,10 @@ 'use strict'; import * as vscode from 'vscode'; -import { LoadNotes } from '../features'; -import { JournalController, Input } from '../model'; -import { NoteInput, SelectedInput, ScopedTemplate } from '../model'; -import { getWeekFromURIAndConfig, isRemoteSession, toLocalFileUri } from '../journal/paths'; -import { SyncDailyLinks } from '../features/sync/sync-daily-links'; +import { LoadNotes } from '../../notes/load-note'; +import { JournalController, Input } from '../../../shared/model/index'; +import { NoteInput, SelectedInput, ScopedTemplate } from '../../../shared/model/index'; +import { isRemoteSession, toLocalFileUri } from '../../../shared/paths'; export class AbstractLoadEntryForDateCommand implements vscode.Disposable { @@ -131,17 +130,8 @@ export class AbstractLoadEntryForDateCommand implements vscode.Disposable { return this.ctrl.reader.loadEntryForInput(input) .then((doc: vscode.TextDocument) => this.ctrl.inject.injectInput(doc, input)) .then((doc: vscode.TextDocument) => { - // Fire-and-forget weekly sync — must never reject loadPageForInput. - getWeekFromURIAndConfig(doc.uri, this.ctrl.config) - .then(weekInfo => { - if (weekInfo && this.ctrl.config.getWeeklySyncConfig().enabled) { - const scopeId = weekInfo.scope === 'default' ? undefined : weekInfo.scope; - new SyncDailyLinks(this.ctrl) - .sync(doc, weekInfo.week, weekInfo.year, scopeId) - .catch(err => this.ctrl.logger.error("loadPageForInput: weekly sync failed:", err)); - } - }) - .catch(err => this.ctrl.logger.error("loadPageForInput: getWeekFromURIAndConfig failed:", err)); + // Notify other features (e.g. weekly daily-link sync) without importing them. + this.ctrl.events.fireEntryOpened({ doc }); return doc; }); } diff --git a/src/commands/show-entry-for-input.ts b/src/features/entries/commands/show-entry-for-input.ts similarity index 95% rename from src/commands/show-entry-for-input.ts rename to src/features/entries/commands/show-entry-for-input.ts index 57f301c..9295766 100644 --- a/src/commands/show-entry-for-input.ts +++ b/src/features/entries/commands/show-entry-for-input.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; +import { JournalController, Input } from '../../../shared/model/index'; import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; diff --git a/src/commands/show-entry-for-today.ts b/src/features/entries/commands/show-entry-for-today.ts similarity index 94% rename from src/commands/show-entry-for-today.ts rename to src/features/entries/commands/show-entry-for-today.ts index 0436f17..badbdd6 100644 --- a/src/commands/show-entry-for-today.ts +++ b/src/features/entries/commands/show-entry-for-today.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; +import { JournalController, Input } from '../../../shared/model/index'; import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; diff --git a/src/commands/show-entry-for-tomorrow.ts b/src/features/entries/commands/show-entry-for-tomorrow.ts similarity index 94% rename from src/commands/show-entry-for-tomorrow.ts rename to src/features/entries/commands/show-entry-for-tomorrow.ts index 6ff8098..4736a9b 100644 --- a/src/commands/show-entry-for-tomorrow.ts +++ b/src/features/entries/commands/show-entry-for-tomorrow.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; +import { JournalController, Input } from '../../../shared/model/index'; import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; diff --git a/src/commands/show-entry-for-yesterday.ts b/src/features/entries/commands/show-entry-for-yesterday.ts similarity index 94% rename from src/commands/show-entry-for-yesterday.ts rename to src/features/entries/commands/show-entry-for-yesterday.ts index 382be85..c5122e2 100644 --- a/src/commands/show-entry-for-yesterday.ts +++ b/src/features/entries/commands/show-entry-for-yesterday.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; +import { JournalController, Input } from '../../../shared/model/index'; import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; diff --git a/src/features/entries/index.ts b/src/features/entries/index.ts deleted file mode 100644 index ea8cf5a..0000000 --- a/src/features/entries/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { WeeklyEntryWatcher } from './weekly-entry-watcher'; -export { LoadNotes } from './load-note'; -export { ScanEntries, sortPickEntries, DecoratedQuickPickItem, TimedQuickPick } from './scan-entries'; diff --git a/src/journal/inject.ts b/src/features/entries/inject.ts similarity index 96% rename from src/journal/inject.ts rename to src/features/entries/inject.ts index d456105..eef3783 100644 --- a/src/journal/inject.ts +++ b/src/features/entries/inject.ts @@ -20,8 +20,8 @@ import * as vscode from 'vscode'; -import { IConfiguration, ILogger, Input, InlineTemplate, InlineString, HeaderTemplate } from '../model'; -import { isNullOrUndefined } from '../util'; +import { IConfiguration, ILogger, Input, InlineTemplate, InlineString, HeaderTemplate } from '../../shared/model/index'; +import { isNullOrUndefined } from '../../shared/index'; diff --git a/src/journal/reader.ts b/src/features/entries/reader.ts similarity index 93% rename from src/journal/reader.ts rename to src/features/entries/reader.ts index 166d596..3d88817 100644 --- a/src/journal/reader.ts +++ b/src/features/entries/reader.ts @@ -19,9 +19,9 @@ 'use strict'; import * as vscode from 'vscode'; -import { IConfiguration, IDialogues, IFileSystem, ILogger, IWriter, Input } from '../model'; -import { isNullOrUndefined, fileExists } from '../util'; -import { resolvePath } from './paths'; +import { IConfiguration, IDialogues, IFileSystem, ILogger, IWriter, Input } from '../../shared/model/index'; +import { isNullOrUndefined, fileExists } from '../../shared/index'; +import { resolvePath } from '../../shared/paths'; export class Reader { public onNotesInjected?: (doc: vscode.TextDocument, date: Date) => void; diff --git a/src/features/entries/scan-entries.ts b/src/features/entries/scan-entries.ts index 783cfc2..dc881bd 100644 --- a/src/features/entries/scan-entries.ts +++ b/src/features/entries/scan-entries.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; -import { inferType } from '../../journal'; -import { FileEntry, IConfiguration, IFileSystem, ILogger, Input, JFileType, JournalPageType, ScopeDirectory } from '../../model'; +import { inferType } from '../../shared/paths'; +import { FileEntry, IConfiguration, IFileSystem, ILogger, Input, JFileType, JournalPageType, ScopeDirectory } from '../../shared/model/index'; import * as Path from 'path'; -import { SCOPE_DEFAULT } from '../../vscode'; +import { SCOPE_DEFAULT } from '../../shared/config/configuration'; export interface DecoratedQuickPickItem extends vscode.QuickPickItem { parsedInput?: Input; diff --git a/src/journal/writer.ts b/src/features/entries/writer.ts similarity index 96% rename from src/journal/writer.ts rename to src/features/entries/writer.ts index 6874ed3..ea3b882 100644 --- a/src/journal/writer.ts +++ b/src/features/entries/writer.ts @@ -19,7 +19,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { DocumentOpener, IConfiguration, IFileSystem, IInject, ILogger } from '../model'; +import { DocumentOpener, IConfiguration, IFileSystem, IInject, ILogger } from '../../shared/model/index'; /** * Anything which modifies the text documents goes here. diff --git a/src/features/index.ts b/src/features/index.ts deleted file mode 100644 index c14f877..0000000 --- a/src/features/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './sync'; -export * from './entries'; diff --git a/src/commands/open-next-entry.ts b/src/features/navigation/commands/open-next-entry.ts similarity index 88% rename from src/commands/open-next-entry.ts rename to src/features/navigation/commands/open-next-entry.ts index f711f90..0379110 100644 --- a/src/commands/open-next-entry.ts +++ b/src/features/navigation/commands/open-next-entry.ts @@ -10,9 +10,9 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; -import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; -import { daysBetween, findAdjacentEntry, getAdjacentWeekInput, resolveAnchor, Mode } from '../journal/navigation'; +import { JournalController, Input } from '../../../shared/model/index'; +import { AbstractLoadEntryForDateCommand } from '../../entries/commands/show-entry-for-date'; +import { daysBetween, findAdjacentEntry, getAdjacentWeekInput, resolveAnchor, Mode } from '../navigation'; export class OpenNextEntryCommand extends AbstractLoadEntryForDateCommand { title: string = "Open the next journal entry"; diff --git a/src/commands/open-previous-entry.ts b/src/features/navigation/commands/open-previous-entry.ts similarity index 88% rename from src/commands/open-previous-entry.ts rename to src/features/navigation/commands/open-previous-entry.ts index 1f4c39d..6a4cb19 100644 --- a/src/commands/open-previous-entry.ts +++ b/src/features/navigation/commands/open-previous-entry.ts @@ -10,9 +10,9 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, Input } from '../model'; -import { AbstractLoadEntryForDateCommand } from './show-entry-for-date'; -import { daysBetween, findAdjacentEntry, getAdjacentWeekInput, resolveAnchor, Mode } from '../journal/navigation'; +import { JournalController, Input } from '../../../shared/model/index'; +import { AbstractLoadEntryForDateCommand } from '../../entries/commands/show-entry-for-date'; +import { daysBetween, findAdjacentEntry, getAdjacentWeekInput, resolveAnchor, Mode } from '../navigation'; export class OpenPreviousEntryCommand extends AbstractLoadEntryForDateCommand { title: string = "Open the previous journal entry"; diff --git a/src/journal/navigation.ts b/src/features/navigation/navigation.ts similarity index 97% rename from src/journal/navigation.ts rename to src/features/navigation/navigation.ts index 0ae5057..e87245b 100644 --- a/src/journal/navigation.ts +++ b/src/features/navigation/navigation.ts @@ -19,9 +19,9 @@ import * as vscode from 'vscode'; import * as Path from 'path'; -import { SCOPE_DEFAULT, ScopeDefinitionLite } from '../vscode/conf'; -import { getDateFromURIAndConfig, getWeekFromURIAndConfig } from './paths'; -import { JournalController, Input } from '../model'; +import { SCOPE_DEFAULT, ScopeDefinitionLite } from '../../shared/config/configuration'; +import { getDateFromURIAndConfig, getWeekFromURIAndConfig } from '../../shared/paths'; +import { JournalController, Input } from '../../shared/model/index'; import moment = require("moment"); /** Direction of entry navigation — step backward or forward relative to the anchor. */ diff --git a/src/commands/show-note.ts b/src/features/notes/commands/show-note.ts similarity index 94% rename from src/commands/show-note.ts rename to src/features/notes/commands/show-note.ts index edd9d77..b5ae3ba 100644 --- a/src/commands/show-note.ts +++ b/src/features/notes/commands/show-note.ts @@ -18,8 +18,8 @@ 'use strict'; import * as vscode from 'vscode'; -import { LoadNotes } from '../features'; -import { JournalController, Input, NoteInput } from '../model'; +import { LoadNotes } from '../load-note'; +import { JournalController, Input, NoteInput } from '../../../shared/model/index'; export class ShowNoteCommand implements vscode.Command, vscode.Disposable { diff --git a/src/features/entries/load-note.ts b/src/features/notes/load-note.ts similarity index 93% rename from src/features/entries/load-note.ts rename to src/features/notes/load-note.ts index 3daf289..5039ca3 100644 --- a/src/features/entries/load-note.ts +++ b/src/features/notes/load-note.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { JournalController, Input, NoteInput } from '../../model'; -import { fileExists } from '../../util'; +import { JournalController, Input, NoteInput } from '../../shared/model/index'; +import { fileExists } from '../../shared/index'; /** * Feature responsible for creating (if needed) and loading notes given a user input as title. diff --git a/src/features/sync/sync-note-links.ts b/src/features/notes/sync-note-links.ts similarity index 98% rename from src/features/sync/sync-note-links.ts rename to src/features/notes/sync-note-links.ts index 87b2d45..aaf1c59 100644 --- a/src/features/sync/sync-note-links.ts +++ b/src/features/notes/sync-note-links.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { JournalController, InlineString } from '../../model'; -import { isNullOrUndefined } from '../../util'; +import { JournalController, InlineString } from '../../shared/model/index'; +import { isNullOrUndefined } from '../../shared/index'; import * as Path from 'path'; diff --git a/src/vscode/dialogues.ts b/src/features/smart-input/dialogues.ts similarity index 98% rename from src/vscode/dialogues.ts rename to src/features/smart-input/dialogues.ts index 6ab1116..1b76142 100644 --- a/src/vscode/dialogues.ts +++ b/src/features/smart-input/dialogues.ts @@ -20,11 +20,11 @@ import * as vscode from 'vscode'; import * as Path from 'path'; -import { isNotNullOrUndefined, isString, isError, stringIsNotEmpty, denormalizeFilename } from '../util'; -import { SCOPE_DEFAULT } from './conf'; +import { isNotNullOrUndefined, isString, isError, stringIsNotEmpty, denormalizeFilename } from '../../shared/index'; +import { SCOPE_DEFAULT } from '../../shared/config/configuration'; import moment = require('moment'); -import { IConfiguration, IFileSystem, ILogger, IParser, JournalPageType, Input, ScopeDirectory, NoteInput, SelectedInput, FileEntry } from '../model'; -import { sortPickEntries, ScanEntries, TimedQuickPick, DecoratedQuickPickItem } from '../features/entries/scan-entries'; +import { IConfiguration, IFileSystem, ILogger, IParser, JournalPageType, Input, ScopeDirectory, NoteInput, SelectedInput, FileEntry } from '../../shared/model/index'; +import { sortPickEntries, ScanEntries, TimedQuickPick, DecoratedQuickPickItem } from '../entries/scan-entries'; diff --git a/src/journal/match-input.ts b/src/features/smart-input/match-input.ts similarity index 99% rename from src/journal/match-input.ts rename to src/features/smart-input/match-input.ts index 4cafd01..781c532 100644 --- a/src/journal/match-input.ts +++ b/src/features/smart-input/match-input.ts @@ -1,7 +1,7 @@ -import { Logger } from "../util/logger"; -import { isNullOrUndefined, isNotNullOrUndefined, getDayOfWeekForString } from "../util/"; -import { Input, ParseConfidence } from "../model/input"; -import { getMonthForString, getCurrentISOWeek } from "../util/dates"; +import { Logger } from '../../shared/logging/logger'; +import { isNullOrUndefined, isNotNullOrUndefined, getDayOfWeekForString } from '../../shared'; +import { Input, ParseConfidence } from '../../shared/model/input'; +import { getMonthForString, getCurrentISOWeek } from '../../shared/dates/dates'; export type EntryGranularity = "daily" | "weekly"; diff --git a/src/journal/parser.ts b/src/features/smart-input/parser.ts similarity index 94% rename from src/journal/parser.ts rename to src/features/smart-input/parser.ts index d71cdbd..3275b44 100644 --- a/src/journal/parser.ts +++ b/src/features/smart-input/parser.ts @@ -18,9 +18,9 @@ 'use strict'; import * as Path from 'path'; -import { IConfiguration, ILogger, Input } from '../model'; -import { normalizeFilename, getCurrentISOWeek, getISOWeekYear } from '../util'; -import { MatchInput } from './match-input'; +import { IConfiguration, ILogger, Input } from '../../shared/model/index'; +import { normalizeFilename, getCurrentISOWeek, getISOWeekYear } from '../../shared/index'; +import { MatchInput } from './match-input'; /** * Helper Methods to interpret the input strings diff --git a/src/features/sync/index.ts b/src/features/sync/index.ts deleted file mode 100644 index 13cd746..0000000 --- a/src/features/sync/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { SyncNoteLinks } from './sync-note-links'; -export { SyncDailyLinks } from './sync-daily-links'; diff --git a/src/ui/codeactions/for-completed-tasks.ts b/src/features/tasks/codeactions/for-completed-tasks.ts similarity index 98% rename from src/ui/codeactions/for-completed-tasks.ts rename to src/features/tasks/codeactions/for-completed-tasks.ts index 5bef75c..6967fa6 100644 --- a/src/ui/codeactions/for-completed-tasks.ts +++ b/src/features/tasks/codeactions/for-completed-tasks.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../../model'; +import { JournalController } from '../../../shared/model/index'; /** diff --git a/src/ui/codeactions/for-open-tasks.ts b/src/features/tasks/codeactions/for-open-tasks.ts similarity index 97% rename from src/ui/codeactions/for-open-tasks.ts rename to src/features/tasks/codeactions/for-open-tasks.ts index 0c82f84..3ec4614 100644 --- a/src/ui/codeactions/for-open-tasks.ts +++ b/src/features/tasks/codeactions/for-open-tasks.ts @@ -19,8 +19,8 @@ import moment = require('moment'); import * as vscode from 'vscode'; -import { JournalController, InlineTemplate } from '../../model'; -import { ShiftTarget } from '../../commands/copy-task'; +import { JournalController, InlineTemplate } from '../../../shared/model/index'; +import { ShiftTarget } from '../commands/copy-task'; /** diff --git a/src/ui/codelens/migrate-tasks.ts b/src/features/tasks/codelens/migrate-tasks.ts similarity index 97% rename from src/ui/codelens/migrate-tasks.ts rename to src/features/tasks/codelens/migrate-tasks.ts index 1145022..1bed163 100644 --- a/src/ui/codelens/migrate-tasks.ts +++ b/src/features/tasks/codelens/migrate-tasks.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../../model'; +import { JournalController } from '../../../shared/model/index'; /** diff --git a/src/ui/codelens/shift-task.ts b/src/features/tasks/codelens/shift-task.ts similarity index 97% rename from src/ui/codelens/shift-task.ts rename to src/features/tasks/codelens/shift-task.ts index dadfe66..50eaec6 100644 --- a/src/ui/codelens/shift-task.ts +++ b/src/features/tasks/codelens/shift-task.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../../model'; +import { JournalController } from '../../../shared/model/index'; export class ShiftTaskCodeLens implements vscode.CodeLensProvider { diff --git a/src/commands/copy-task.ts b/src/features/tasks/commands/copy-task.ts similarity index 99% rename from src/commands/copy-task.ts rename to src/features/tasks/commands/copy-task.ts index cd7a927..e29cdc4 100644 --- a/src/commands/copy-task.ts +++ b/src/features/tasks/commands/copy-task.ts @@ -19,7 +19,7 @@ import moment = require('moment'); import * as vscode from 'vscode'; -import { JournalController, InlineString, InlineTemplate } from '../model'; +import { JournalController, InlineString, InlineTemplate } from '../../../shared/model/index'; export enum ShiftTarget { nextWorkingDay, diff --git a/src/vscode/vscode-codelens.ts b/src/features/tasks/vscode-codelens.ts similarity index 97% rename from src/vscode/vscode-codelens.ts rename to src/features/tasks/vscode-codelens.ts index 8705840..447ea39 100644 --- a/src/vscode/vscode-codelens.ts +++ b/src/features/tasks/vscode-codelens.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../model'; +import { JournalController } from '../../shared/model/index'; export class JournalCodeLensProvider implements vscode.CodeLensProvider { private codeLenses: vscode.CodeLens[] = []; diff --git a/src/commands/open-journal-workspace.ts b/src/features/tools/commands/open-journal-workspace.ts similarity index 95% rename from src/commands/open-journal-workspace.ts rename to src/features/tools/commands/open-journal-workspace.ts index 0e9cd6b..5765b16 100644 --- a/src/commands/open-journal-workspace.ts +++ b/src/features/tools/commands/open-journal-workspace.ts @@ -18,8 +18,8 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../model'; -import { isRemoteSession, toLocalFileUri } from '../journal/paths'; +import { JournalController } from '../../../shared/model/index'; +import { isRemoteSession, toLocalFileUri } from '../../../shared/paths'; export class OpenJournalWorkspaceCommand implements vscode.Command, vscode.Disposable { diff --git a/src/commands/print-current-time.ts b/src/features/tools/commands/print-current-time.ts similarity index 96% rename from src/commands/print-current-time.ts rename to src/features/tools/commands/print-current-time.ts index df731b7..19f24c7 100644 --- a/src/commands/print-current-time.ts +++ b/src/features/tools/commands/print-current-time.ts @@ -18,7 +18,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController, ScopedTemplate } from '../model'; +import { JournalController, ScopedTemplate } from '../../../shared/model/index'; export class PrintTimeCommand implements vscode.Command, vscode.Disposable { diff --git a/src/commands/print-duration-between-selected-times.ts b/src/features/tools/commands/print-duration-between-selected-times.ts similarity index 97% rename from src/commands/print-duration-between-selected-times.ts rename to src/features/tools/commands/print-duration-between-selected-times.ts index b62ad2e..e1f0158 100644 --- a/src/commands/print-duration-between-selected-times.ts +++ b/src/features/tools/commands/print-duration-between-selected-times.ts @@ -18,9 +18,9 @@ 'use strict'; import moment = require('moment'); -import { JournalController } from '../model'; +import { JournalController } from '../../../shared/model/index'; import * as vscode from 'vscode'; -import { isNullOrUndefined } from '../util'; +import { isNullOrUndefined } from '../../../shared/index'; export class PrintDurationCommand implements vscode.Command, vscode.Disposable { diff --git a/src/commands/print-sum-of-selected-numbers.ts b/src/features/tools/commands/print-sum-of-selected-numbers.ts similarity index 96% rename from src/commands/print-sum-of-selected-numbers.ts rename to src/features/tools/commands/print-sum-of-selected-numbers.ts index 4327560..c81a642 100644 --- a/src/commands/print-sum-of-selected-numbers.ts +++ b/src/features/tools/commands/print-sum-of-selected-numbers.ts @@ -18,8 +18,8 @@ 'use strict'; import * as vscode from 'vscode'; -import { JournalController } from '../model'; -import { isNullOrUndefined } from '../util'; +import { JournalController } from '../../../shared/model/index'; +import { isNullOrUndefined } from '../../../shared/index'; export class PrintSumCommand implements vscode.Command, vscode.Disposable { diff --git a/src/features/sync/sync-daily-links.ts b/src/features/weekly/sync-daily-links.ts similarity index 94% rename from src/features/sync/sync-daily-links.ts rename to src/features/weekly/sync-daily-links.ts index dce236d..3410dd8 100644 --- a/src/features/sync/sync-daily-links.ts +++ b/src/features/weekly/sync-daily-links.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode'; -import { JournalController } from '../../model'; +import { JournalController } from '../../shared/model/index'; import * as Path from 'path'; -import { getDateFromURIAndConfig } from '../../journal'; -import { getDatesOfISOWeek, replaceVariableValue } from '../../util'; -import { resolveDate } from '../../journal/template-engine'; -import { fileExists } from '../../util/fs-exists'; +import { getDateFromURIAndConfig } from '../../shared/paths'; +import { getDatesOfISOWeek, replaceVariableValue } from '../../shared/index'; +import { resolveDate } from '../../shared/templates/template-engine'; +import { fileExists } from '../../shared/fs/fs-exists'; export class SyncDailyLinks { diff --git a/src/features/entries/weekly-entry-watcher.ts b/src/features/weekly/weekly-entry-watcher.ts similarity index 95% rename from src/features/entries/weekly-entry-watcher.ts rename to src/features/weekly/weekly-entry-watcher.ts index 9847ab2..ac3c9c8 100644 --- a/src/features/entries/weekly-entry-watcher.ts +++ b/src/features/weekly/weekly-entry-watcher.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode'; -import { JournalController } from '../../model'; -import { getDatesOfISOWeek } from '../../util/dates'; -import { getWeekFromURIAndConfig } from '../../journal/paths'; -import { SyncDailyLinks } from '../sync/sync-daily-links'; +import { JournalController } from '../../shared/model/index'; +import { getDatesOfISOWeek } from '../../shared/dates/dates'; +import { getWeekFromURIAndConfig } from '../../shared/paths'; +import { SyncDailyLinks } from './sync-daily-links'; /** * Listens for active-editor changes and maintains a narrow FileSystemWatcher diff --git a/src/journal/index.ts b/src/journal/index.ts deleted file mode 100644 index 5b59cdd..0000000 --- a/src/journal/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 Patrick Maué -// -// This file is part of vscode-journal. -// -// vscode-journal is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// vscode-journal is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with vscode-journal. If not, see . -// - - - -export { Parser } from './parser'; -export { Writer } from './writer'; -export { Reader } from './reader'; -export { Inject } from './inject'; -export { MatchInput } from './match-input'; -export { - checkIfFileIsAccessible, - getDateFromURI, - getDateFromURIAndConfig, - getFileInURI, - getFilePathInDateFolder, - getPathAsString, - getPathOfMonth, - getWeekFromURIAndConfig, - inferType, - resolvePath, -} from './paths'; -export { resolveDate, toMomentFormat } from './template-engine'; diff --git a/src/vscode/conf.ts b/src/shared/config/configuration.ts similarity index 97% rename from src/vscode/conf.ts rename to src/shared/config/configuration.ts index ea590a0..cd42af7 100644 --- a/src/vscode/conf.ts +++ b/src/shared/config/configuration.ts @@ -21,9 +21,9 @@ import { EntryGranularity, HeaderTemplate, IConfiguration, InlineTemplate, InputDetailsTimeFormat, IWorkspaceConfigReader, NavigationMode, ScopeDefinitionLite, ScopedTemplate, SCOPE_DEFAULT, WeeklySyncConfig, } from '../model'; -import { SettingsReader } from './config/settings-reader'; -import { PathResolver } from './config/path-resolver'; -import { TemplateProvider } from './config/template-provider'; +import { SettingsReader } from './settings-reader'; +import { PathResolver } from './path-resolver'; +import { TemplateProvider } from './template-provider'; export { SCOPE_DEFAULT, WeeklySyncConfig }; export { EntryGranularity, NavigationMode, ScopeDefinitionLite } from '../model/config'; diff --git a/src/vscode/config/path-resolver.ts b/src/shared/config/path-resolver.ts similarity index 98% rename from src/vscode/config/path-resolver.ts rename to src/shared/config/path-resolver.ts index 4267b32..81f9981 100644 --- a/src/vscode/config/path-resolver.ts +++ b/src/shared/config/path-resolver.ts @@ -19,9 +19,9 @@ import * as os from 'os'; import * as Path from 'path'; -import { IWorkspaceConfigReader, ScopedTemplate, SCOPE_DEFAULT } from '../../model'; -import { isNullOrUndefined, replaceVariableValue } from '../../util'; -import { resolveDate } from '../../journal/template-engine'; +import { IWorkspaceConfigReader, ScopedTemplate, SCOPE_DEFAULT } from '../model/index'; +import { isNullOrUndefined, replaceVariableValue } from '../index'; +import { resolveDate } from '../templates/template-engine'; import { defaultPatternDefinition, PatternDefinition, ScopeDefinition } from './patterns'; import { IJournalSettings } from './settings-reader'; diff --git a/src/vscode/config/patterns.ts b/src/shared/config/patterns.ts similarity index 97% rename from src/vscode/config/patterns.ts rename to src/shared/config/patterns.ts index 9bca57f..1feeb67 100644 --- a/src/vscode/config/patterns.ts +++ b/src/shared/config/patterns.ts @@ -17,7 +17,7 @@ // 'use strict'; -import { InlineTemplate } from '../../model'; +import { InlineTemplate } from '../model/index'; /** Shape of the `journal.patterns` setting. */ export type PatternDefinition = { diff --git a/src/vscode/config/settings-reader.ts b/src/shared/config/settings-reader.ts similarity index 99% rename from src/vscode/config/settings-reader.ts rename to src/shared/config/settings-reader.ts index 156f0e0..586a294 100644 --- a/src/vscode/config/settings-reader.ts +++ b/src/shared/config/settings-reader.ts @@ -20,8 +20,8 @@ import * as vscode from 'vscode'; import * as os from 'os'; import * as Path from 'path'; -import { isNotNullOrUndefined, isNullOrUndefined, stringIsNotEmpty } from '../../util'; -import { EntryGranularity, InlineTemplate, IWorkspaceConfigReader, NavigationMode, ScopeDefinitionLite, SCOPE_DEFAULT, WeeklySyncConfig } from '../../model'; +import { isNotNullOrUndefined, isNullOrUndefined, stringIsNotEmpty } from '../index'; +import { EntryGranularity, InlineTemplate, IWorkspaceConfigReader, NavigationMode, ScopeDefinitionLite, SCOPE_DEFAULT, WeeklySyncConfig } from '../model/index'; import { ScopeDefinition } from './patterns'; /** diff --git a/src/vscode/config/template-provider.ts b/src/shared/config/template-provider.ts similarity index 97% rename from src/vscode/config/template-provider.ts rename to src/shared/config/template-provider.ts index 060db61..e9db9a2 100644 --- a/src/vscode/config/template-provider.ts +++ b/src/shared/config/template-provider.ts @@ -17,9 +17,9 @@ // 'use strict'; -import { HeaderTemplate, InlineTemplate, ScopedTemplate, SCOPE_DEFAULT } from '../../model'; -import { isNullOrUndefined, replaceVariableValue } from '../../util'; -import { resolveDate } from '../../journal/template-engine'; +import { HeaderTemplate, InlineTemplate, ScopedTemplate, SCOPE_DEFAULT } from '../model/index'; +import { isNullOrUndefined, replaceVariableValue } from '../index'; +import { resolveDate } from '../templates/template-engine'; import { IJournalSettings } from './settings-reader'; /** diff --git a/src/util/dates.ts b/src/shared/dates/dates.ts similarity index 100% rename from src/util/dates.ts rename to src/shared/dates/dates.ts diff --git a/src/shared/events/index.ts b/src/shared/events/index.ts new file mode 100644 index 0000000..76f2a98 --- /dev/null +++ b/src/shared/events/index.ts @@ -0,0 +1 @@ +export { JournalEvents } from './journal-events'; diff --git a/src/shared/events/journal-events.ts b/src/shared/events/journal-events.ts new file mode 100644 index 0000000..e4af7f9 --- /dev/null +++ b/src/shared/events/journal-events.ts @@ -0,0 +1,40 @@ +// Copyright (C) 2018 Patrick Maué +// +// This file is part of vscode-journal. +// +// vscode-journal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// vscode-journal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with vscode-journal. If not, see . +// +'use strict'; + +import * as vscode from 'vscode'; +import { EntryOpenedEvent, IJournalEvents } from '../model'; + +/** + * Typed cross-feature event bus backed by `vscode.EventEmitter`. Features + * publish signals here and subscribe to others' signals, so no feature has to + * import another feature's internals (#234). + */ +export class JournalEvents implements IJournalEvents, vscode.Disposable { + + private readonly entryOpened = new vscode.EventEmitter(); + public readonly onEntryOpened = this.entryOpened.event; + + public fireEntryOpened(event: EntryOpenedEvent): void { + this.entryOpened.fire(event); + } + + public dispose(): void { + this.entryOpened.dispose(); + } +} diff --git a/src/util/fs-exists.ts b/src/shared/fs/fs-exists.ts similarity index 93% rename from src/util/fs-exists.ts rename to src/shared/fs/fs-exists.ts index 34300cf..5e07aba 100644 --- a/src/util/fs-exists.ts +++ b/src/shared/fs/fs-exists.ts @@ -1,6 +1,6 @@ 'use strict'; -import { IFileSystem } from '../model'; +import { IFileSystem } from '../model/index'; // Returns true if the path resolves to an existing entry on the filesystem, // false if it definitely does not exist, and rethrows for any other FS error. diff --git a/src/vscode/vscode-fs.ts b/src/shared/fs/vscode-fs.ts similarity index 95% rename from src/vscode/vscode-fs.ts rename to src/shared/fs/vscode-fs.ts index e9eea4b..9d6e56e 100644 --- a/src/vscode/vscode-fs.ts +++ b/src/shared/fs/vscode-fs.ts @@ -1,7 +1,7 @@ 'use strict'; import * as vscode from 'vscode'; -import { IFileSystem, JFileStat, JFileType } from '../model'; +import { IFileSystem, JFileStat, JFileType } from '../model/index'; function toJFileType(t: vscode.FileType): JFileType { switch (t) { diff --git a/src/util/index.ts b/src/shared/index.ts similarity index 84% rename from src/util/index.ts rename to src/shared/index.ts index 683728e..922624e 100644 --- a/src/util/index.ts +++ b/src/shared/index.ts @@ -17,12 +17,12 @@ // -export { ConsoleLogger, Logger } from './logger'; +export { ConsoleLogger, Logger } from './logging/logger'; export { isError, isNullOrUndefined, isNotNullOrUndefined, -} from './util'; +} from './lang'; export { formatDate, getCurrentISOWeek, @@ -30,7 +30,7 @@ export { getDayOfWeekForString, getISOWeekYear, getMonthForString, -} from './dates'; +} from './dates/dates'; export { denormalizeFilename, getDayAsString, @@ -40,5 +40,5 @@ export { prefixZero, replaceVariableValue, stringIsNotEmpty, -} from './strings'; -export { fileExists } from './fs-exists'; \ No newline at end of file +} from './strings/strings'; +export { fileExists } from './fs/fs-exists'; \ No newline at end of file diff --git a/src/util/util.ts b/src/shared/lang.ts similarity index 100% rename from src/util/util.ts rename to src/shared/lang.ts diff --git a/src/util/logger.ts b/src/shared/logging/logger.ts similarity index 93% rename from src/util/logger.ts rename to src/shared/logging/logger.ts index 0d4fb20..b4e8c97 100644 --- a/src/util/logger.ts +++ b/src/shared/logging/logger.ts @@ -18,9 +18,9 @@ import * as vscode from 'vscode'; -import { IConfiguration } from '../model'; -import { isString } from './strings'; -import { isError, isNotNullOrUndefined } from './util'; +import { IConfiguration } from '../model/index'; +import { isString } from '../strings/strings'; +import { isError, isNotNullOrUndefined } from '../lang'; export interface Logger { trace(message: string, ...optionalParams: any[]): void; diff --git a/src/model/config.ts b/src/shared/model/config.ts similarity index 100% rename from src/model/config.ts rename to src/shared/model/config.ts diff --git a/src/model/files.ts b/src/shared/model/files.ts similarity index 100% rename from src/model/files.ts rename to src/shared/model/files.ts diff --git a/src/model/fs.ts b/src/shared/model/fs.ts similarity index 100% rename from src/model/fs.ts rename to src/shared/model/fs.ts diff --git a/src/model/index.ts b/src/shared/model/index.ts similarity index 92% rename from src/model/index.ts rename to src/shared/model/index.ts index eafacff..4f8f067 100644 --- a/src/model/index.ts +++ b/src/shared/model/index.ts @@ -17,11 +17,11 @@ // -export { EntryGranularity, HeaderTemplate, InlineTemplate, InputDetailsTimeFormat, JournalPageType, NavigationMode, ScopeDefinitionLite, ScopedTemplate, SCOPE_DEFAULT, WeeklySyncConfig } from './config'; -export { InlineString } from './inline'; -export { Input, NoteInput, SelectedInput } from './input'; -export { ScopeDirectory, TemplateInfo } from './templates'; -export { FileEntry } from './files'; -export { ILogger, IConfiguration, IParser, IWriter, IReader, IInject, IDialogues, IFileSystem, DocumentOpener, JournalController, IWorkspaceConfigReader } from './interfaces'; -export { JFileType, JFileStat } from './fs'; +export { EntryGranularity, HeaderTemplate, InlineTemplate, InputDetailsTimeFormat, JournalPageType, NavigationMode, ScopeDefinitionLite, ScopedTemplate, SCOPE_DEFAULT, WeeklySyncConfig } from './config'; +export { InlineString } from './inline'; +export { Input, NoteInput, SelectedInput } from './input'; +export { ScopeDirectory, TemplateInfo } from './templates'; +export { FileEntry } from './files'; +export { ILogger, IConfiguration, IParser, IWriter, IReader, IInject, IDialogues, IFileSystem, DocumentOpener, JournalController, IWorkspaceConfigReader, EntryOpenedEvent, IJournalEvents } from './interfaces'; +export { JFileType, JFileStat } from './fs'; diff --git a/src/model/inline.ts b/src/shared/model/inline.ts similarity index 100% rename from src/model/inline.ts rename to src/shared/model/inline.ts diff --git a/src/model/input.ts b/src/shared/model/input.ts similarity index 93% rename from src/model/input.ts rename to src/shared/model/input.ts index 2fcc7ee..8a016c6 100644 --- a/src/model/input.ts +++ b/src/shared/model/input.ts @@ -19,8 +19,8 @@ 'use strict'; -import { isNullOrUndefined } from "../util/util"; -import { SCOPE_DEFAULT } from "./config"; +import { isNullOrUndefined } from '../lang'; +import { SCOPE_DEFAULT } from './config'; export type ParseConfidence = 'resolved' | 'ambiguous' | 'text-only'; diff --git a/src/model/interfaces.ts b/src/shared/model/interfaces.ts similarity index 93% rename from src/model/interfaces.ts rename to src/shared/model/interfaces.ts index 4ae6865..3ac0c78 100644 --- a/src/model/interfaces.ts +++ b/src/shared/model/interfaces.ts @@ -98,6 +98,17 @@ export interface IFileSystem { delete(path: string, options?: { recursive?: boolean }): Promise; } +/** Fired when a journal entry document has been opened/created. */ +export interface EntryOpenedEvent { + doc: vscode.TextDocument; +} + +/** Cross-feature signal bus. Features publish/subscribe here instead of importing each other. */ +export interface IJournalEvents { + readonly onEntryOpened: vscode.Event; + fireEntryOpened(event: EntryOpenedEvent): void; +} + export interface JournalController { config: IConfiguration; logger: ILogger; @@ -107,6 +118,7 @@ export interface JournalController { inject: IInject; ui: IDialogues; fs: IFileSystem; + events: IJournalEvents; } export interface IWorkspaceConfigReader { diff --git a/src/model/templates.ts b/src/shared/model/templates.ts similarity index 100% rename from src/model/templates.ts rename to src/shared/model/templates.ts diff --git a/src/journal/paths.ts b/src/shared/paths.ts similarity index 97% rename from src/journal/paths.ts rename to src/shared/paths.ts index a7f9161..01af999 100644 --- a/src/journal/paths.ts +++ b/src/shared/paths.ts @@ -20,11 +20,11 @@ import * as Path from 'path'; import * as vscode from 'vscode'; -import { JournalPageType } from '../model'; -import { IConfiguration } from '../model'; -import { getDayAsString, prefixZero } from '../util/strings'; -import { isNullOrUndefined } from '../util/util'; -import { toMomentFormat } from './template-engine'; +import { JournalPageType } from './model/index'; +import { IConfiguration } from './model/index'; +import { getDayAsString, prefixZero } from './strings/strings'; +import { isNullOrUndefined } from './lang'; +import { toMomentFormat } from './templates/template-engine'; import moment = require('moment'); /** diff --git a/src/util/strings.ts b/src/shared/strings/strings.ts similarity index 98% rename from src/util/strings.ts rename to src/shared/strings/strings.ts index a041a6d..dfdaba3 100644 --- a/src/util/strings.ts +++ b/src/shared/strings/strings.ts @@ -18,7 +18,7 @@ 'use strict'; -import { isNotNullOrUndefined } from '.'; +import { isNotNullOrUndefined } from '../index'; export function getDayAsString(date: Date): string { diff --git a/src/journal/template-engine.ts b/src/shared/templates/template-engine.ts similarity index 100% rename from src/journal/template-engine.ts rename to src/shared/templates/template-engine.ts diff --git a/src/test/direct/direct.ts b/src/test/direct/direct.ts index 8903144..50fbac0 100644 --- a/src/test/direct/direct.ts +++ b/src/test/direct/direct.ts @@ -1,6 +1,6 @@ import moment = require("moment"); -import { ScopedTemplate } from "../../model"; +import { ScopedTemplate } from '../../shared/model/index'; let regExpDateFormats: RegExp = new RegExp(/\$\{(?:(year|month|day|localTime|localDate)|(d:\w+))\}/g); diff --git a/src/test/direct/input-parser.ts b/src/test/direct/input-parser.ts index 2e57141..db4a2b5 100644 --- a/src/test/direct/input-parser.ts +++ b/src/test/direct/input-parser.ts @@ -1,4 +1,4 @@ -import { MatchInput } from '../../journal/match-input'; +import { MatchInput } from '../../features/smart-input/match-input'; import { TestLogger } from '../test-logger'; let inputMatcher = new MatchInput(new TestLogger(false), "en-US"); diff --git a/src/test/direct/path-parse-with-date.ts b/src/test/direct/path-parse-with-date.ts index 86441c5..180134e 100644 --- a/src/test/direct/path-parse-with-date.ts +++ b/src/test/direct/path-parse-with-date.ts @@ -1,6 +1,6 @@ import * as assert from 'assert'; import moment = require('moment'); -import { toMomentFormat } from '../../journal/template-engine'; +import { toMomentFormat } from '../../shared/templates/template-engine'; let base = "c:\\Users\\user\\Git\\vscode-journal\\test\\workspace\\journal"; let pathTpl = "${base}/${year}-${month}"; let fileTpl = "${year}${month}${day}.${ext}"; diff --git a/src/test/direct/replace-variables-in-string.ts b/src/test/direct/replace-variables-in-string.ts index e32a491..fef4084 100644 --- a/src/test/direct/replace-variables-in-string.ts +++ b/src/test/direct/replace-variables-in-string.ts @@ -1,4 +1,4 @@ -import { resolveDate as replaceDateFormats } from "../../journal/template-engine"; +import { resolveDate as replaceDateFormats } from '../../shared/templates/template-engine'; diff --git a/src/test/fake-workspace-config.ts b/src/test/fake-workspace-config.ts index 66ff56c..6fc3674 100644 --- a/src/test/fake-workspace-config.ts +++ b/src/test/fake-workspace-config.ts @@ -1,4 +1,4 @@ -import { IWorkspaceConfigReader } from '../model'; +import { IWorkspaceConfigReader } from '../shared/model/index'; export class FakeWorkspaceConfig implements IWorkspaceConfigReader { constructor(private readonly settings: Record = {}) {} diff --git a/src/test/in-memory-fs.ts b/src/test/in-memory-fs.ts index 155fdc4..33262c4 100644 --- a/src/test/in-memory-fs.ts +++ b/src/test/in-memory-fs.ts @@ -1,6 +1,6 @@ 'use strict'; -import { IFileSystem, JFileStat, JFileType } from '../model'; +import { IFileSystem, JFileStat, JFileType } from '../shared/model/index'; function notFound(path: string): never { const err = new Error(`FileNotFound: ${path}`) as NodeJS.ErrnoException & { code: string }; diff --git a/src/test/suite/codeaction-tasks.test.ts b/src/test/suite/codeaction-tasks.test.ts index 1dbb5cb..8ec19f0 100644 --- a/src/test/suite/codeaction-tasks.test.ts +++ b/src/test/suite/codeaction-tasks.test.ts @@ -1,8 +1,8 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { OpenTaskActions } from '../../ui/codeactions/for-open-tasks'; -import { CompletedTaskActions } from '../../ui/codeactions/for-completed-tasks'; -import { InlineTemplate, ScopedTemplate } from '../../model'; +import { OpenTaskActions } from '../../features/tasks/codeactions/for-open-tasks'; +import { CompletedTaskActions } from '../../features/tasks/codeactions/for-completed-tasks'; +import { InlineTemplate, ScopedTemplate } from '../../shared/model/index'; import { createMockCtrl, openEditor } from './command-test-helpers'; function makeRange(line: number, startChar: number, endChar: number): vscode.Range { diff --git a/src/test/suite/command-test-helpers.ts b/src/test/suite/command-test-helpers.ts index 597898e..a038f9f 100644 --- a/src/test/suite/command-test-helpers.ts +++ b/src/test/suite/command-test-helpers.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { InlineString, InlineTemplate, Input, NoteInput, ScopedTemplate } from '../../model'; +import { InlineString, InlineTemplate, Input, NoteInput, ScopedTemplate } from '../../shared/model/index'; import { TestLogger } from '../test-logger'; export type MockCtrl = any; @@ -9,6 +9,10 @@ export function createMockCtrl(overrides: Partial = {}): MockCtrl { const ctrl: MockCtrl = { __calls: calls, logger: new TestLogger(false), + events: { + onEntryOpened: (_listener: unknown) => ({ dispose() { } }), + fireEntryOpened: (_event: unknown) => undefined, + }, ui: { showDocument: async (_doc: vscode.TextDocument) => undefined, showError: (msg: string) => calls.showError.push(msg), diff --git a/src/test/suite/commands-copy-task.test.ts b/src/test/suite/commands-copy-task.test.ts index ac1eef1..651795d 100644 --- a/src/test/suite/commands-copy-task.test.ts +++ b/src/test/suite/commands-copy-task.test.ts @@ -1,7 +1,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { InlineString, InlineTemplate } from '../../model'; -import { ShiftTarget, CopyTaskCommand } from '../../commands/copy-task'; +import { InlineString, InlineTemplate } from '../../shared/model/index'; +import { ShiftTarget, CopyTaskCommand } from '../../features/tasks/commands/copy-task'; import { createMockCtrl } from './command-test-helpers'; suite('Command suites - copy task command', () => { diff --git a/src/test/suite/commands-entry.test.ts b/src/test/suite/commands-entry.test.ts index de86653..c8822ec 100644 --- a/src/test/suite/commands-entry.test.ts +++ b/src/test/suite/commands-entry.test.ts @@ -2,15 +2,15 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Input } from '../../model'; -import { Container } from '../../app'; -import { ShowEntryForInputCommand } from '../../commands/show-entry-for-input'; -import { ShowEntryForTodayCommand } from '../../commands/show-entry-for-today'; -import { ShowEntryForTomorrowCommand } from '../../commands/show-entry-for-tomorrow'; -import { ShowEntryForYesterdayCommand } from '../../commands/show-entry-for-yesterday'; +import { Input } from '../../shared/model/index'; +import { Container } from '../../app/index'; +import { ShowEntryForInputCommand } from '../../features/entries/commands/show-entry-for-input'; +import { ShowEntryForTodayCommand } from '../../features/entries/commands/show-entry-for-today'; +import { ShowEntryForTomorrowCommand } from '../../features/entries/commands/show-entry-for-tomorrow'; +import { ShowEntryForYesterdayCommand } from '../../features/entries/commands/show-entry-for-yesterday'; import { createMockCtrl, tick } from './command-test-helpers'; import { TestLogger } from '../test-logger'; -import { fileExists } from '../../util/fs-exists'; +import { fileExists } from '../../shared/fs/fs-exists'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; function buildCtrl(tmpBase: string): { ctrl: Container; logger: TestLogger } { diff --git a/src/test/suite/commands-inject.test.ts b/src/test/suite/commands-inject.test.ts index a89fc6a..e6e2525 100644 --- a/src/test/suite/commands-inject.test.ts +++ b/src/test/suite/commands-inject.test.ts @@ -2,8 +2,8 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Input } from '../../model'; -import { Container } from '../../app'; +import { Input } from '../../shared/model/index'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/commands-note-workspace.test.ts b/src/test/suite/commands-note-workspace.test.ts index 6660f9a..d945247 100644 --- a/src/test/suite/commands-note-workspace.test.ts +++ b/src/test/suite/commands-note-workspace.test.ts @@ -1,7 +1,7 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { OpenJournalWorkspaceCommand } from '../../commands/open-journal-workspace'; -import { ShowNoteCommand } from '../../commands/show-note'; +import { OpenJournalWorkspaceCommand } from '../../features/tools/commands/open-journal-workspace'; +import { ShowNoteCommand } from '../../features/notes/commands/show-note'; import { createMockCtrl } from './command-test-helpers'; suite('Command suites - note/workspace commands', () => { diff --git a/src/test/suite/commands-note.test.ts b/src/test/suite/commands-note.test.ts index 26a1214..f35cb15 100644 --- a/src/test/suite/commands-note.test.ts +++ b/src/test/suite/commands-note.test.ts @@ -2,10 +2,10 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Container } from '../../app'; -import { ShowNoteCommand } from '../../commands/show-note'; +import { Container } from '../../app/index'; +import { ShowNoteCommand } from '../../features/notes/commands/show-note'; import { TestLogger } from '../test-logger'; -import { fileExists } from '../../util/fs-exists'; +import { fileExists } from '../../shared/fs/fs-exists'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; function buildCtrl(tmpBase: string): { ctrl: Container; logger: TestLogger } { diff --git a/src/test/suite/commands-prev-next.test.ts b/src/test/suite/commands-prev-next.test.ts index eafee29..83fe84b 100644 --- a/src/test/suite/commands-prev-next.test.ts +++ b/src/test/suite/commands-prev-next.test.ts @@ -2,7 +2,7 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Container } from '../../app'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; import { @@ -12,10 +12,10 @@ import { getAdjacentWeekInput, resolveAnchor, stripTime, -} from '../../journal/navigation'; -import { SCOPE_DEFAULT } from '../../vscode'; -import { OpenNextEntryCommand } from '../../commands/open-next-entry'; -import { OpenPreviousEntryCommand } from '../../commands/open-previous-entry'; +} from '../../features/navigation/navigation'; +import { SCOPE_DEFAULT } from '../../shared/config/configuration'; +import { OpenNextEntryCommand } from '../../features/navigation/commands/open-next-entry'; +import { OpenPreviousEntryCommand } from '../../features/navigation/commands/open-previous-entry'; async function seedEntry(base: string, year: number, month: number, day: number, content = '# Entry\n'): Promise { const yy = String(year).padStart(4, '0'); diff --git a/src/test/suite/commands-print.test.ts b/src/test/suite/commands-print.test.ts index a8ee18b..4267902 100644 --- a/src/test/suite/commands-print.test.ts +++ b/src/test/suite/commands-print.test.ts @@ -1,9 +1,9 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { Input, ScopedTemplate } from '../../model'; -import { PrintTimeCommand } from '../../commands/print-current-time'; -import { PrintSumCommand } from '../../commands/print-sum-of-selected-numbers'; -import { PrintDurationCommand } from '../../commands/print-duration-between-selected-times'; +import { Input, ScopedTemplate } from '../../shared/model/index'; +import { PrintTimeCommand } from '../../features/tools/commands/print-current-time'; +import { PrintSumCommand } from '../../features/tools/commands/print-sum-of-selected-numbers'; +import { PrintDurationCommand } from '../../features/tools/commands/print-duration-between-selected-times'; import { createMockCtrl, openEditor } from './command-test-helpers'; suite('Command suites - print commands', () => { diff --git a/src/test/suite/commands-weekly.test.ts b/src/test/suite/commands-weekly.test.ts index 37dc691..c71cbec 100644 --- a/src/test/suite/commands-weekly.test.ts +++ b/src/test/suite/commands-weekly.test.ts @@ -2,9 +2,9 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Container } from '../../app'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; -import { fileExists } from '../../util/fs-exists'; +import { fileExists } from '../../shared/fs/fs-exists'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; function buildCtrl(tmpBase: string): { ctrl: Container; logger: TestLogger } { diff --git a/src/test/suite/infer-type.test.ts b/src/test/suite/infer-type.test.ts index e1f36da..4edf6be 100644 --- a/src/test/suite/infer-type.test.ts +++ b/src/test/suite/infer-type.test.ts @@ -1,7 +1,7 @@ import * as assert from 'assert'; import * as Path from 'path'; -import { inferType, InferTypeContext } from '../../journal/paths'; -import { JournalPageType } from '../../model/config'; +import { inferType, InferTypeContext } from '../../shared/paths'; +import { JournalPageType } from '../../shared/model/config'; suite('inferType — classification', () => { const ctx: InferTypeContext = { extension: '.md' }; diff --git a/src/test/suite/input.test.ts b/src/test/suite/input.test.ts index 0ffb95d..f9946d7 100644 --- a/src/test/suite/input.test.ts +++ b/src/test/suite/input.test.ts @@ -4,10 +4,10 @@ import * as assert from 'assert'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import { Input, NoteInput } from '../../model'; -import { Container } from '../../app'; +import { Input, NoteInput } from '../../shared/model/index'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; -import { SCOPE_DEFAULT } from '../../model/config'; +import { SCOPE_DEFAULT } from '../../shared/model/config'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; suite('Open Journal Entries', () => { diff --git a/src/test/suite/issue-168-entry-granularity.test.ts b/src/test/suite/issue-168-entry-granularity.test.ts index b45ba0b..f7f93cf 100644 --- a/src/test/suite/issue-168-entry-granularity.test.ts +++ b/src/test/suite/issue-168-entry-granularity.test.ts @@ -3,12 +3,12 @@ import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; import moment = require('moment'); -import { Input } from '../../model'; -import { Container } from '../../app'; -import { Configuration } from '../../vscode'; +import { Input } from '../../shared/model/index'; +import { Container } from '../../app/index'; +import { Configuration } from '../../shared/config/configuration'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; -import { MatchInput } from '../../journal/match-input'; +import { MatchInput } from '../../features/smart-input/match-input'; function buildCtrl(settings: Record): { ctrl: Container; logger: TestLogger } { const logger = new TestLogger(false); diff --git a/src/test/suite/issue-185-weekly-sync.test.ts b/src/test/suite/issue-185-weekly-sync.test.ts index e68481d..0805d54 100644 --- a/src/test/suite/issue-185-weekly-sync.test.ts +++ b/src/test/suite/issue-185-weekly-sync.test.ts @@ -3,11 +3,11 @@ import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; import moment = require('moment'); -import { Container } from '../../app'; -import { Configuration } from '../../vscode'; -import { SyncDailyLinks } from '../../features/sync/sync-daily-links'; -import { getWeekFromURIAndConfig } from '../../journal/paths'; -import { getDatesOfISOWeek } from '../../util/dates'; +import { Container } from '../../app/index'; +import { Configuration } from '../../shared/config/configuration'; +import { SyncDailyLinks } from '../../features/weekly/sync-daily-links'; +import { getWeekFromURIAndConfig } from '../../shared/paths'; +import { getDatesOfISOWeek } from '../../shared/dates/dates'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/issue-232-note-offset.test.ts b/src/test/suite/issue-232-note-offset.test.ts index 6ffb7bc..5c28d79 100644 --- a/src/test/suite/issue-232-note-offset.test.ts +++ b/src/test/suite/issue-232-note-offset.test.ts @@ -2,9 +2,9 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Input, NoteInput } from '../../model'; -import { Container } from '../../app'; -import { LoadNotes } from '../../features/entries/load-note'; +import { Input, NoteInput } from '../../shared/model/index'; +import { Container } from '../../app/index'; +import { LoadNotes } from '../../features/notes/load-note'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/issue-51-remote-create.test.ts b/src/test/suite/issue-51-remote-create.test.ts index 6d1cd14..d86680d 100644 --- a/src/test/suite/issue-51-remote-create.test.ts +++ b/src/test/suite/issue-51-remote-create.test.ts @@ -2,11 +2,11 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { NoteInput } from '../../model'; -import { Container } from '../../app'; -import { LoadNotes } from '../../features/entries/load-note'; -import { fileExists } from '../../util/fs-exists'; -import { VscodeFileSystem } from '../../vscode/vscode-fs'; +import { NoteInput } from '../../shared/model/index'; +import { Container } from '../../app/index'; +import { LoadNotes } from '../../features/notes/load-note'; +import { fileExists } from '../../shared/fs/fs-exists'; +import { VscodeFileSystem } from '../../shared/fs/vscode-fs'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/match-input-vocab.test.ts b/src/test/suite/match-input-vocab.test.ts index 170b2bc..f405157 100644 --- a/src/test/suite/match-input-vocab.test.ts +++ b/src/test/suite/match-input-vocab.test.ts @@ -1,5 +1,5 @@ import * as assert from 'assert'; -import { MatchInput } from '../../journal/match-input'; +import { MatchInput } from '../../features/smart-input/match-input'; import { TestLogger } from '../test-logger'; function make(locale = 'en', granularity: 'daily' | 'weekly' = 'daily'): MatchInput { diff --git a/src/test/suite/notes-sync.test.ts b/src/test/suite/notes-sync.test.ts index 24a5be3..bbcff7e 100644 --- a/src/test/suite/notes-sync.test.ts +++ b/src/test/suite/notes-sync.test.ts @@ -6,9 +6,9 @@ import * as path from 'path'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import { NoteInput } from '../../model'; -import { Container } from '../../app'; -import { LoadNotes } from '../../features/entries/load-note'; +import { NoteInput } from '../../shared/model/index'; +import { Container } from '../../app/index'; +import { LoadNotes } from '../../features/notes/load-note'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/phase1-regression.test.ts b/src/test/suite/phase1-regression.test.ts index 879a385..2279123 100644 --- a/src/test/suite/phase1-regression.test.ts +++ b/src/test/suite/phase1-regression.test.ts @@ -1,9 +1,9 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; -import { Logger } from '../../util'; -import { Container } from '../../app'; -import { Configuration } from '../../vscode'; -import { MatchInput } from '../../journal/match-input'; +import { Logger } from '../../shared/index'; +import { Container } from '../../app/index'; +import { Configuration } from '../../shared/config/configuration'; +import { MatchInput } from '../../features/smart-input/match-input'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/read-templates.test.ts b/src/test/suite/read-templates.test.ts index 7d0b12f..304f724 100644 --- a/src/test/suite/read-templates.test.ts +++ b/src/test/suite/read-templates.test.ts @@ -3,9 +3,9 @@ import * as assert from 'assert'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import { LoadNotes } from '../../features'; -import { Input, NoteInput } from '../../model'; -import { Container } from '../../app'; +import { LoadNotes } from '../../features/notes/load-note'; +import { Input, NoteInput } from '../../shared/model/index'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; import { suite, before, test } from 'mocha'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/scan-entries-cache.test.ts b/src/test/suite/scan-entries-cache.test.ts index 1101d68..42294fd 100644 --- a/src/test/suite/scan-entries-cache.test.ts +++ b/src/test/suite/scan-entries-cache.test.ts @@ -2,10 +2,10 @@ import * as assert from 'assert'; import * as os from 'os'; import * as path from 'path'; import * as vscode from 'vscode'; -import { Container } from '../../app'; +import { Container } from '../../app/index'; import { ScanEntries } from '../../features/entries/scan-entries'; -import { SCOPE_DEFAULT } from '../../vscode'; -import { JournalPageType, ScopeDirectory } from '../../model'; +import { SCOPE_DEFAULT } from '../../shared/config/configuration'; +import { JournalPageType, ScopeDirectory } from '../../shared/model/index'; import { TestLogger } from '../test-logger'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/scan-entries-unit.test.ts b/src/test/suite/scan-entries-unit.test.ts index f2b6e19..076cfa3 100644 --- a/src/test/suite/scan-entries-unit.test.ts +++ b/src/test/suite/scan-entries-unit.test.ts @@ -5,7 +5,7 @@ import * as path from 'path'; import { ScanEntries } from '../../features/entries/scan-entries'; import { InMemoryFileSystem } from '../in-memory-fs'; import { TestLogger } from '../test-logger'; -import { IConfiguration, JFileType, SCOPE_DEFAULT, ScopeDirectory } from '../../model'; +import { IConfiguration, JFileType, SCOPE_DEFAULT, ScopeDirectory } from '../../shared/model/index'; function makeScanner(fs: InMemoryFileSystem): ScanEntries { const stubConfig: Partial = { diff --git a/src/test/suite/template-engine.test.ts b/src/test/suite/template-engine.test.ts index b83250c..fe8d541 100644 --- a/src/test/suite/template-engine.test.ts +++ b/src/test/suite/template-engine.test.ts @@ -1,5 +1,5 @@ import * as assert from 'assert'; -import { resolveDate, toMomentFormat } from '../../journal/template-engine'; +import { resolveDate, toMomentFormat } from '../../shared/templates/template-engine'; const KNOWN_DATE = new Date(2024, 2, 5, 14, 30, 0); // 2024-03-05 14:30 diff --git a/src/test/suite/week-input.test.ts b/src/test/suite/week-input.test.ts index 74adc80..50ba856 100644 --- a/src/test/suite/week-input.test.ts +++ b/src/test/suite/week-input.test.ts @@ -4,7 +4,7 @@ import moment = require('moment'); // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import { Container } from '../../app'; +import { Container } from '../../app/index'; import { TestLogger } from '../test-logger'; import { suite, before, test } from 'mocha'; import { FakeWorkspaceConfig } from '../fake-workspace-config'; diff --git a/src/test/suite/writer-unit.test.ts b/src/test/suite/writer-unit.test.ts index 84d698e..a6d7d56 100644 --- a/src/test/suite/writer-unit.test.ts +++ b/src/test/suite/writer-unit.test.ts @@ -2,10 +2,10 @@ import * as assert from 'assert'; import * as path from 'path'; -import { Writer } from '../../journal/writer'; +import { Writer } from '../../features/entries/writer'; import { InMemoryFileSystem } from '../in-memory-fs'; import { TestLogger } from '../test-logger'; -import { IConfiguration, IInject } from '../../model'; +import { IConfiguration, IInject } from '../../shared/model/index'; suite('writer-unit — Writer with InMemoryFileSystem', () => { diff --git a/src/test/test-logger.ts b/src/test/test-logger.ts index cdd4c6a..bb3327d 100644 --- a/src/test/test-logger.ts +++ b/src/test/test-logger.ts @@ -1,4 +1,4 @@ -import { Logger } from "../util/logger"; +import { Logger } from '../shared/logging/logger'; export class TestLogger implements Logger { public readonly errors: string[] = []; diff --git a/src/ui/index.ts b/src/ui/index.ts deleted file mode 100644 index 494cdc3..0000000 --- a/src/ui/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { MigrateTasksCodeLens } from './codelens/migrate-tasks'; -export { ShiftTaskCodeLens } from './codelens/shift-task'; -export { CompletedTaskActions } from './codeactions/for-completed-tasks'; -export { OpenTaskActions } from './codeactions/for-open-tasks'; diff --git a/src/vscode/index.ts b/src/vscode/index.ts deleted file mode 100644 index 19eae55..0000000 --- a/src/vscode/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2017 Patrick Maué -// -// This file is part of vscode-journal. -// -// vscode-journal is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// vscode-journal is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with vscode-journal. If not, see . -// - -export { Dialogues } from './dialogues'; -export { JournalCodeLensProvider } from './vscode-codelens'; -export { - Configuration, - SCOPE_DEFAULT, - WeeklySyncConfig, -} from './conf';