Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pnpm i # if you're using pnpm, or npm install if you're using npm
## build the codex-webviews
codex-editor % cd webviews/codex-webviews
codex-webviews % pnpm i
codex-webviews % pnpm run build
codex-webviews % pnpm run build:all

## build the dictionary-side-panel
codex-webviews % cd ../dictionary-side-panel
Expand Down
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@
"shortTitle": "Start a new Project",
"command": "codex-editor-extension.initializeNewProject"
},
{
"title": "Import USFM",
"shortTitle": "Import USFM",
"command": "codex-editor-extension.importUsfm"
},
{
"title": "Export USFM",
"shortTitle": "Export USFM",
"command": "codex-editor-extension.exportUsfm"
},
{
"command": "codex-editor-extension.downloadSourceTextBibles",
"title": "Download Source Text Bible"
Expand Down Expand Up @@ -424,6 +434,7 @@
},
"scripts": {
"vscode:prepublish": "npm run compile",
"build": "webpack",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
Expand Down Expand Up @@ -482,13 +493,19 @@
"moment": "^2.30.1",
"path": "^0.12.7",
"pnpm": "^8.15.5",
"proskomma-core": "^0.10.4",
"proskomma-json-tools": "^0.8.7",
"react-wordcloud": "^1.2.7",
"semver": "^7.6.0",
"sinon": "^17.0.1",
"string-punctuation-tokenizer": "^2.2.0",
"uuid": "^9.0.1",
"vscode-languageclient": "^9.0.1",
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.11"
"vscode-languageserver-textdocument": "^1.0.11",
"wordmap": "^0.6.0",
"wordmap-lexer": "^0.3.5",
"wordmapbooster": "^1.0.0"
},
"overrides": {
"minimatch": "5.1.2",
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { initializeWebviews } from "./activationHelpers/contextAware/webviewInit
import { syncUtils } from "./activationHelpers/contextAware/syncUtils";
import { initializeStateStore } from "./stateStore";
import { projectFileExists } from "./utils/fileUtils";
import { registerUsfmImporter } from "./usfmStuff/importUsfm";

// The following block ensures a smooth user experience by guiding the user through the initial setup process before the extension is fully activated. This is crucial for setting up the necessary project environment and avoiding any functionality issues that might arise from missing project configurations.

Expand All @@ -48,6 +49,7 @@ export async function activate(context: vscode.ExtensionContext) {
registerReferencesCodeLens(context);
registerSourceCodeLens(context);
registerTextSelectionHandler(context, () => undefined);
registerUsfmImporter(context);

const [, syncStatus] = registerScmStatusBar(context);
syncUtils.registerSyncCommands(context, syncStatus);
Expand All @@ -73,7 +75,7 @@ export function deactivate(): Thenable<void> {
}

async function executeCommandsAfter() {
// wasn't sure if these had to be executed seperately but it's here to be on the safeside, otherwise later it should go in commands.ts
// wasn't sure if these had to be executed separately but it's here to be on the safe side, otherwise later it should go in commands.ts

vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
vscode.commands.executeCommand(
Expand Down
1 change: 1 addition & 0 deletions src/providers/dictionaryTable/DictionaryTablePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class DictionaryTablePanel {
id: "",
label: "",
entries: [{
headForm: "",
id: "",
headWord: "",
variantForms: [],
Expand Down
6 changes: 3 additions & 3 deletions src/providers/obs/data/TextTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"en": "Exodus"
},
"long": {
"en": "The Second Book of Mosis, Commonly Called Exodus"
"en": "The Second Book of Moses, Commonly Called Exodus"
}
},
"LEV": {
Expand All @@ -89,7 +89,7 @@
"en": "Leviticus"
},
"long": {
"en": "The Third Book of Mosis, Commonly Called Leviticus"
"en": "The Third Book of Moses, Commonly Called Leviticus"
}
},
"NUM": {
Expand Down Expand Up @@ -287,7 +287,7 @@
"en": "Ecclesiastes"
},
"long": {
"en": "Ecclesiates or, The Preacher"
"en": "Ecclesiastes or, The Preacher"
}
},
"SNG": {
Expand Down
110 changes: 110 additions & 0 deletions src/usfmStuff/customizedJLDiff.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@


export interface TAttributedChar {
char: string;
blockIndex: number;
contentIndex: number;
charIndex: number;
isMeta: boolean;
supplemented?: boolean;
}


export interface TAttributedString extends Array<TAttributedChar> {}


export enum DiffState {
STATE_MATCH,
STATE_PASSING_1ST,
STATE_PASSING_2ND
}


class LineCompIndex {
errorCount: number;
previous: LineCompIndex | null;
state: DiffState;
content: TAttributedChar;

constructor() {
this.errorCount = 0;
this.previous = null;
this.state = DiffState.STATE_PASSING_1ST;
this.content = { char: "", blockIndex: 0, contentIndex: 0, charIndex: 0, isMeta: false };
}
}

export function traceDiffs( content1: TAttributedString, content2: TAttributedString ){
let lastLine : LineCompIndex[] = [];
let thisLine : LineCompIndex[] = [];

//init the root root
let thisIndex = new LineCompIndex();
thisIndex.state = DiffState.STATE_MATCH;
thisLine.push(thisIndex);

//init the root top case
let columnIndex = 1;
content2.forEach( (char2, index2) => {
thisIndex = new LineCompIndex();
thisIndex.previous = thisLine[ columnIndex-1 ];
thisIndex.errorCount = thisIndex.previous.errorCount+1;
thisIndex.content = char2;
thisIndex.state = DiffState.STATE_PASSING_2ND;
thisLine.push( thisIndex );
columnIndex += 1;
});

content1.forEach( (char1, index1) => {
lastLine = thisLine;
thisLine = [];

//init the root left case
thisIndex = new LineCompIndex();
thisIndex.previous = lastLine[ 0 ];
thisIndex.errorCount = thisIndex.previous.errorCount+1;
thisIndex.content = char1;
thisIndex.state = DiffState.STATE_PASSING_1ST;
thisLine.push( thisIndex );

columnIndex = 1;
for (const char2 of content2) {
thisIndex = new LineCompIndex();

if( char2.char == char1.char && char2.isMeta == char1.isMeta ){
thisIndex.previous = lastLine[ columnIndex-1 ];
thisIndex.errorCount = thisIndex.previous.errorCount;

thisIndex.state = DiffState.STATE_MATCH;
thisIndex.content = char1;

}else{
if( lastLine[ columnIndex ].errorCount < thisLine[ columnIndex-1 ].errorCount ){
thisIndex.previous = lastLine[ columnIndex ];
thisIndex.content = char1;
thisIndex.state = DiffState.STATE_PASSING_1ST;
}else{
thisIndex.previous = thisLine[ columnIndex-1 ];
thisIndex.content = char2;
thisIndex.state = DiffState.STATE_PASSING_2ND;
}

thisIndex.errorCount = thisIndex.previous.errorCount+1;
}

thisLine.push( thisIndex );
columnIndex += 1;
}
});

const backwardsList : LineCompIndex[] = [];
let currentNode : LineCompIndex | null = thisLine[ thisLine.length-1 ];
while( currentNode != null ){
backwardsList.push( currentNode);
currentNode = currentNode.previous;
}

const forwardsList = backwardsList.reverse();

return forwardsList;
}
Loading