Skip to content

Commit

Permalink
Initial implementation of quotation checker for TextDocuments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben King committed Nov 18, 2024
1 parent 6be3210 commit 1824761
Show file tree
Hide file tree
Showing 27 changed files with 6,304 additions and 251 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Diagnostic, DiagnosticFix, DiagnosticSeverity, DocumentManager, TextDocument } from '@sillsdev/lynx';

import { AbstractChecker } from './abstract-checker';
import { DiagnosticFactory } from './diagnostic-factory';
import { DiagnosticList } from './diagnostic-list';
import { AllowedCharacterSet } from './rule-set/allowed-character-set';
import { AbstractChecker } from '../abstract-checker';
import { DiagnosticFactory } from '../diagnostic-factory';
import { DiagnosticList } from '../diagnostic-list';
import { AllowedCharacterSet } from './allowed-character-set';

export class AllowedCharacterChecker extends AbstractChecker {
constructor(
Expand Down Expand Up @@ -43,7 +43,6 @@ class AllowedCharacterIssueFinder {
public produceDiagnostics(text: string): Diagnostic[] {
this.diagnosticList = new DiagnosticList();

// TODO: convert to a standard Unicode format like NFKC
let match: RegExpExecArray | null;
while ((match = this.characterRegex.exec(text))) {
const character = match[0];
Expand Down
8 changes: 4 additions & 4 deletions packages/punctuation-checker/src/diagnostic-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ class DiagnosticBuilder {
private readonly textDocument: TextDocument,
) {}

public setCode(code: string | number): DiagnosticBuilder {
public setCode(code: string | number): this {
this.code = code;
return this;
}

public setSeverity(severity: DiagnosticSeverity): DiagnosticBuilder {
public setSeverity(severity: DiagnosticSeverity): this {
this.severity = severity;
return this;
}

public setRange(startIndex: number, endIndex: number): DiagnosticBuilder {
public setRange(startIndex: number, endIndex: number): this {
this.range = {
start: this.textDocument.positionAt(startIndex),
end: this.textDocument.positionAt(endIndex),
};
return this;
}

public setMessage(message: string): DiagnosticBuilder {
public setMessage(message: string): this {
this.message = message;
return this;
}
Expand Down
191 changes: 0 additions & 191 deletions packages/punctuation-checker/src/example-punctuation-checker.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/punctuation-checker/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { ExamplePunctuationChecker } from './example-punctuation-checker';
export { RuleSet } from './rule-set/rule-set';
export { RuleSet, RuleType } from './rule-set/rule-set';
export { StandardRuleSets } from './rule-set/standard-rule-sets';
3 changes: 0 additions & 3 deletions packages/punctuation-checker/src/main.ts

This file was deleted.

Loading

0 comments on commit 1824761

Please sign in to comment.