Skip to content

SF-3344 Add Lynx punctuation checker #3174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3bfeec4
lynx punctuation checker prototype
siltomato Jul 22, 2024
e020b7c
Integrate Lynx library
ddaspit Feb 12, 2025
d94b087
Fix issues when updating insights
ddaspit Feb 12, 2025
bd57fe3
Add Lynx Punctuation Checker
ddaspit Mar 19, 2025
a00d429
Update lynx-punctuation-checker dependency
ddaspit Mar 24, 2025
51eae1a
remove 'dismiss' option and filter for MVP
siltomato Mar 14, 2025
36733d7
hide overlay action menu if no non-primary actions
siltomato Mar 17, 2025
a51385a
use quietTakeUntilDestroyed
siltomato Mar 18, 2025
d53287f
use quietTakeUntilDestroyed
siltomato Mar 20, 2025
def0cea
fix overlay close triggers
siltomato Mar 25, 2025
57e9c70
improve problem panel text sample
siltomato Mar 25, 2025
19fa363
Fix errors when switching documents
ddaspit Mar 25, 2025
68eadd4
adjust styling for multi-insight overlay
siltomato Mar 25, 2025
2b63010
hide insight code
siltomato Mar 25, 2025
fdee0e0
don't hardcode apply shortcut keys
siltomato Mar 25, 2025
f3d86aa
fix segment ref parsing
siltomato Mar 26, 2025
4339c48
adjust problem panel sample text
siltomato Mar 26, 2025
6185aff
fix overlapping insights of the same severity
siltomato Mar 26, 2025
b678231
fix insight scroll position indicator
siltomato Mar 26, 2025
5e8eff7
hide editor local cursor when editor loses focus
siltomato Mar 28, 2025
e467f1f
focus overlay, not editor when open
siltomato Mar 31, 2025
65d139b
fix problems panel links to other chapters to open overlay
siltomato Mar 31, 2025
0e808ea
remove 'dismissed' insights prop from project user config
siltomato Mar 31, 2025
6bb6a27
scroll editor to ensure overlay is within editor bounds
siltomato Apr 1, 2025
2dda6a2
convert to lynx editor adapter
siltomato Apr 8, 2025
042ed6a
add tests
siltomato Apr 11, 2025
7dfd97b
adjust lynx styles after new material theming rebase
siltomato Apr 11, 2025
38775f2
group problems panel items by description instead of code
siltomato Apr 11, 2025
6d919b6
inject to workspace service constructor to allow easier testing
siltomato Apr 16, 2025
267a99d
add tests
siltomato Apr 16, 2025
30d5c85
adjust styles
siltomato Apr 21, 2025
d9c700f
clean up
siltomato Apr 21, 2025
663078c
fix trackby
siltomato Apr 21, 2025
a63849f
changes from coderabbit review findings
siltomato Apr 24, 2025
649b46e
fix incorrect insight range in editor after note embed
siltomato May 5, 2025
32f04f7
add backend lynx user data model
siltomato May 5, 2025
f547d79
use spread syntax
siltomato May 5, 2025
ac9f0d3
misc code review changes
siltomato May 6, 2025
fb1d25c
ensure note fab is above lynx status indicator
siltomato May 6, 2025
807117f
reference range converter by interface
siltomato May 8, 2025
78a3e37
correct backend types
siltomato May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"caniuse",
"cdnjs",
"Charis",
"checkmark",
"combobox",
"commenters",
"compodoc",
Expand All @@ -29,6 +30,7 @@
"indexeddb",
"ldml",
"listbox",
"Lynxable",
"mailto",
"mingo",
"mixins",
Expand Down
3 changes: 2 additions & 1 deletion scripts/db_tools/parse-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class ParseVersion {
'Upload Paratext Zip Files for Pre-Translation Drafting',
'Allow mixing in an additional training source',
'Updated Learning Rate For Serval',
'Dark Mode'
'Dark Mode',
'Enable Lynx insights'
];

constructor() {
Expand Down
11 changes: 11 additions & 0 deletions src/RealtimeServer/scriptureforge/models/lynx-insight-user-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LynxInsightFilter, LynxInsightSortOrder } from './lynx-insight';

export interface LynxInsightUserData {
panelData?: LynxInsightPanelUserData;
}

export interface LynxInsightPanelUserData {
isOpen: boolean;
filter: LynxInsightFilter;
sortOrder: LynxInsightSortOrder;
}
16 changes: 16 additions & 0 deletions src/RealtimeServer/scriptureforge/models/lynx-insight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Ordered by severity, lowest to highest
export const LynxInsightTypes = ['info', 'warning', 'error'] as const;
export type LynxInsightType = (typeof LynxInsightTypes)[number];

// Ordered from widest to narrowest scope
export const LynxInsightFilterScopes = ['project', 'book', 'chapter'] as const;
export type LynxInsightFilterScope = (typeof LynxInsightFilterScopes)[number];

export const LynxInsightSortOrders = ['severity', 'appearance'] as const;
export type LynxInsightSortOrder = (typeof LynxInsightSortOrders)[number];

export interface LynxInsightFilter {
types: LynxInsightType[];
scope: LynxInsightFilterScope;
includeDismissed?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export function createTestProjectUserConfig(overrides?: RecursivePartial<SFProje
answerRefsRead: [],
commentRefsRead: [],
noteRefsRead: [],
editorTabsOpen: []
editorTabsOpen: [],
lynxInsightState: {}
};

return merge(defaultSFProjectUserConfig, overrides);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PROJECT_DATA_INDEX_PATHS, ProjectData } from '../../common/models/project-data';
import { EditorTabPersistData } from './editor-tab-persist-data';
import { LynxInsightUserData } from './lynx-insight-user-data';

export const SF_PROJECT_USER_CONFIGS_COLLECTION = 'sf_project_user_configs';
export const SF_PROJECT_USER_CONFIG_INDEX_PATHS: string[] = PROJECT_DATA_INDEX_PATHS;
Expand Down Expand Up @@ -28,4 +29,5 @@ export interface SFProjectUserConfig extends ProjectData {
answerRefsRead: string[];
commentRefsRead: string[];
editorTabsOpen: EditorTabPersistData[];
lynxInsightState: LynxInsightUserData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,24 @@
}
}

class SFProjectUserConfigMigration8 extends DocMigration {
static readonly VERSION = 8;

async migrateDoc(doc: Doc): Promise<void> {

Check warning on line 91 in src/RealtimeServer/scriptureforge/services/sf-project-user-config-migrations.ts

View check run for this annotation

Codecov / codecov/patch

src/RealtimeServer/scriptureforge/services/sf-project-user-config-migrations.ts#L91

Added line #L91 was not covered by tests
if (doc.data.lynxInsightState === undefined) {
const op: ObjectInsertOp = { p: ['lynxInsightState'], oi: {} };
await submitMigrationOp(SFProjectUserConfigMigration8.VERSION, doc, [op]);

Check warning on line 94 in src/RealtimeServer/scriptureforge/services/sf-project-user-config-migrations.ts

View check run for this annotation

Codecov / codecov/patch

src/RealtimeServer/scriptureforge/services/sf-project-user-config-migrations.ts#L93-L94

Added lines #L93 - L94 were not covered by tests
}
}
}

export const SF_PROJECT_USER_CONFIG_MIGRATIONS: MigrationConstructor[] = monotonicallyIncreasingMigrationList([
SFProjectUserConfigMigration1,
SFProjectUserConfigMigration2,
SFProjectUserConfigMigration3,
SFProjectUserConfigMigration4,
SFProjectUserConfigMigration5,
SFProjectUserConfigMigration6,
SFProjectUserConfigMigration7
SFProjectUserConfigMigration7,
SFProjectUserConfigMigration8
]);
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,39 @@ export class SFProjectUserConfigService extends SFProjectDataService<SFProjectUs
},
additionalProperties: false
}
},
lynxInsightState: {
bsonType: 'object',
properties: {
panelData: {
bsonType: 'object',
required: ['isOpen', 'filter', 'sortOrder'],
properties: {
isOpen: {
bsonType: 'bool'
},
filter: {
bsonType: 'object',
required: ['types', 'scope'],
properties: {
types: {
bsonType: 'array',
items: {
bsonType: 'string'
}
},
scope: {
bsonType: 'string'
}
}
},
sortOrder: {
bsonType: 'string'
}
}
}
},
additionalProperties: false
}
},
additionalProperties: false
Expand Down
6 changes: 3 additions & 3 deletions src/SIL.XForge.Scripture/ClientApp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
],
"optimization": true,
"outputHashing": "all",
"namedChunks": false,
"namedChunks": true,
"aot": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -102,7 +102,7 @@
],
"optimization": true,
"outputHashing": "all",
"namedChunks": false,
"namedChunks": true,
"aot": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -116,7 +116,7 @@
}
],
"outputHashing": "all",
"namedChunks": false,
"namedChunks": true,
"vendorChunk": false,
"serviceWorker": true
},
Expand Down
67 changes: 56 additions & 11 deletions src/SIL.XForge.Scripture/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/SIL.XForge.Scripture/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"@microsoft/signalr": "^7.0.0",
"@ngneat/transloco": "^4.3.0",
"@ngneat/transloco-locale": "^4.1.0",
"@sillsdev/lynx": "^0.3.4",
"@sillsdev/lynx-delta": "^0.2.1",
"@sillsdev/lynx-punctuation-checker": "^0.1.4",
"@sillsdev/machine": "^2.4.2",
"@sillsdev/scripture": "1.4.1",
"angular-file": "^4.0.2",
Expand All @@ -73,7 +76,7 @@
"papaparse": "^5.3.2",
"process": "^0.11.10",
"quill": "^2.0.3",
"quill-cursors": "^3.1.2",
"quill-cursors": "^4.0.4",
"realtime-server": "file:../../RealtimeServer",
"reconnecting-websocket": "^4.4.0",
"rich-text": "^4.1.0",
Expand Down
6 changes: 4 additions & 2 deletions src/SIL.XForge.Scripture/ClientApp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { GlobalNoticesComponent } from './shared/global-notices/global-notices.c
import { SharedModule } from './shared/shared.module';
import { TextNoteDialogComponent } from './shared/text/text-note-dialog/text-note-dialog.component';
import { SyncComponent } from './sync/sync.component';
import { LynxInsightsModule } from './translate/editor/lynx/insights/lynx-insights.module';
import { TranslateModule } from './translate/translate.module';
import { UsersModule } from './users/users.module';

Expand Down Expand Up @@ -78,11 +79,12 @@ import { UsersModule } from './users/users.module';
TranslocoModule,
TranslocoMarkupModule,
AppRoutingModule,
SharedModule,
SharedModule.forRoot(),
AvatarComponent,
MatRipple,
GlobalNoticesComponent,
QuillModule.forRoot()
QuillModule.forRoot(),
LynxInsightsModule.forRoot()
],
providers: [
{ provide: APP_ID, useValue: 'ng-cli-universal' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('AttachAudioComponent', () => {
let env: TestEnvironment;

configureTestingModule(() => ({
imports: [UICommonModule, ngfModule, SharedModule, TestTranslocoModule, TestOnlineStatusModule.forRoot()],
imports: [UICommonModule, ngfModule, SharedModule.forRoot(), TestTranslocoModule, TestOnlineStatusModule.forRoot()],
declarations: [AttachAudioComponent],
providers: [{ provide: DialogService, useMock: mockDialogService }]
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('CheckingTextComponent', () => {
declarations: [CheckingTextComponent],
imports: [
NoopAnimationsModule,
SharedModule,
SharedModule.forRoot(),
UICommonModule,
TestRealtimeModule.forRoot(SF_TYPE_REGISTRY),
TestOnlineStatusModule.forRoot(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('CheckingComponent', () => {
ngfModule,
NoopAnimationsModule,
RouterModule.forRoot(ROUTES),
SharedModule,
SharedModule.forRoot(),
UICommonModule,
OwnerComponent,
TestTranslocoModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { SF_TYPE_REGISTRY } from '../../core/models/sf-type-registry';
import { TextDoc, TextDocId } from '../../core/models/text-doc';
import { SFProjectService } from '../../core/sf-project.service';
import { ScriptureChooserDialogComponent } from '../../scripture-chooser-dialog/scripture-chooser-dialog.component';
import { SharedModule } from '../../shared/shared.module';
import { getTextDoc } from '../../shared/test-utils';
import { EDITOR_READY_TIMEOUT } from '../../shared/text/text.component';
import { CheckingModule } from '../checking.module';
Expand All @@ -65,6 +66,7 @@ describe('QuestionDialogComponent', () => {
ReactiveFormsModule,
FormsModule,
DialogTestModule,
SharedModule.forRoot(),
TestOnlineStatusModule.forRoot(),
TestRealtimeModule.forRoot(SF_TYPE_REGISTRY)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('MyProjectsComponent', () => {
declarations: [MyProjectsComponent],
imports: [
UICommonModule,
SharedModule,
SharedModule.forRoot(),
RouterModule.forRoot([
{ path: 'projects/:projectId', component: EmptyComponent },
{ path: 'connect-project', component: EmptyComponent }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const meta: Meta = {
moduleMetadata({
imports: [
UICommonModule,
SharedModule,
SharedModule.forRoot(),
RouterModule.forChild([
{ path: 'projects/:projectId', component: EmptyComponent },
{ path: 'connect-project', component: EmptyComponent }
Expand Down
Loading
Loading