Skip to content

Add instructions for using this ext in dev of another#2197

Draft
imnasnainaec wants to merge 2 commits intodevelopfrom
pb-ext-readme-drop-into-paranext-core
Draft

Add instructions for using this ext in dev of another#2197
imnasnainaec wants to merge 2 commits intodevelopfrom
pb-ext-readme-drop-into-paranext-core

Conversation

@imnasnainaec
Copy link
Collaborator

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a6907a84-142d-4279-85c1-012587623bcf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds documentation for integrating the extension with another development extension and updates the service registration key naming convention from fwliteextension.entryService to fwLiteExtension.entryService across multiple files. Minor method signature improvements also rename unused parameters for clarity.

Changes

Cohort / File(s) Summary
Documentation Updates
platform.bible-extension/README.md
Added new section "Using this extension with another development extension" with build, relocation, and service registration workflow details including code snippets and example references.
Service Key Registration Updates
platform.bible-extension/src/main.ts, platform.bible-extension/src/web-views/add-word.web-view.tsx, platform.bible-extension/src/web-views/find-related-words.web-view.tsx, platform.bible-extension/src/web-views/find-word.web-view.tsx
Consistently renamed service lookup key from fwliteextension.entryService to fwLiteExtension.entryService across all network object retrievals.
Service Implementation Refinements
platform.bible-extension/src/services/entry-service.ts
Added TODO comment on fwLiteApi field and renamed updateEntry method parameters to _projectId and _reference to explicitly indicate unused parameters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

🟨Medium

Suggested reviewers

  • jasonleenaylor
  • hahn-kev

Poem

🐰 A key rename hops through the code so neat,
fwLiteExtension makes the service complete,
Four files align with camelCase delight,
Documentation blooms—the integration shines bright! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a pull request description explaining the purpose and scope of the documentation additions and service key updates.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding documentation instructions for using the extension during development of another extension.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pb-ext-readme-drop-into-paranext-core
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@imnasnainaec imnasnainaec force-pushed the pb-ext-readme-drop-into-paranext-core branch from c5fcd78 to 613cdfa Compare March 9, 2026 14:45
@imnasnainaec imnasnainaec marked this pull request as ready for review March 9, 2026 14:45
@imnasnainaec imnasnainaec added the 🟨Medium Medium-priority PR label Mar 9, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@platform.bible-extension/README.md`:
- Around line 163-181: The doc shows the consumer calling
papi.networkObjects.set and importing EntryService which incorrectly
re-registers a provider; instead instruct the consumer to retrieve the existing
service with await
papi.networkObjects.get<IEntryService>('fwLiteExtension.entryService') (so they
do not import EntryService or hard-code the URL) and remove the code that adds
the returned entryService to context.registrations (i.e., do not call
context.registrations.add(await entryService)); mirror the usage in
src/web-views/add-word.web-view.tsx and reference the symbols
papi.networkObjects.get, papi.networkObjects.set, fwLiteExtension.entryService,
EntryService, IEntryService, and context.registrations.add when locating the
lines to change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eaca491d-f7bf-439e-9a6d-c7db93f99d00

📥 Commits

Reviewing files that changed from the base of the PR and between 39a7877 and 613cdfa.

📒 Files selected for processing (6)
  • platform.bible-extension/README.md
  • platform.bible-extension/src/main.ts
  • platform.bible-extension/src/services/entry-service.ts
  • platform.bible-extension/src/web-views/add-word.web-view.tsx
  • platform.bible-extension/src/web-views/find-related-words.web-view.tsx
  • platform.bible-extension/src/web-views/find-word.web-view.tsx

Comment on lines +163 to +181
3. In the other extension's `main.ts`, add the following two things inside `activate`:

```ts
const entryService = papi.networkObjects.set(
'fwLiteExtension.entryService',
new EntryService('http://localhost:29348'), // TODO: avoid hard-coding the base URL
'fw-lite-extension.IEntryService',
);
```

```ts
context.registrations.add(
/* ... along with other unsubscribers ... */

await entryService,
);
```

4. An example of using this network service is found in [add-word.web-view.tsx](src/web-views/add-word.web-view.tsx).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Document consumption with get(...), not provider registration.

After step 2, the installed fw-lite-extension already owns fwLiteExtension.entryService from its own activate(). Having the other extension call networkObjects.set(...) again turns the consumer into a second provider, can conflict with the installed extension, and requires importing the internal EntryService implementation. This example should mirror src/web-views/add-word.web-view.tsx and retrieve the existing service instead.

📝 Suggested doc fix
-3. In the other extension's `main.ts`, add the following two things inside `activate`:
+3. In the other extension, retrieve the existing network service instead of registering a new one:

 ```ts
-const entryService = papi.networkObjects.set(
-  'fwLiteExtension.entryService',
-  new EntryService('http://localhost:29348'), // TODO: avoid hard-coding the base URL
-  'fw-lite-extension.IEntryService',
+const entryService = await papi.networkObjects.get<IEntryService>(
+  'fwLiteExtension.entryService',
 );

-```ts
-context.registrations.add(

  • /* ... along with other unsubscribers ... */
  • await entryService,
    -);
    -```
  1. An example of using this network service is found in add-word.web-view.tsx.
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
3. In the other extension, retrieve the existing network service instead of registering a new one:

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platform.bible-extension/README.md` around lines 163 - 181, The doc shows the
consumer calling papi.networkObjects.set and importing EntryService which
incorrectly re-registers a provider; instead instruct the consumer to retrieve
the existing service with await
papi.networkObjects.get<IEntryService>('fwLiteExtension.entryService') (so they
do not import EntryService or hard-code the URL) and remove the code that adds
the returned entryService to context.registrations (i.e., do not call
context.registrations.add(await entryService)); mirror the usage in
src/web-views/add-word.web-view.tsx and reference the symbols
papi.networkObjects.get, papi.networkObjects.set, fwLiteExtension.entryService,
EntryService, IEntryService, and context.registrations.add when locating the
lines to change.

Copy link
Collaborator

@myieye myieye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love how simple and elegant this looks 👍
Looks like you found just the right way to do this.


export class EntryService implements IEntryService {
private fwLiteApi: FwLiteApi;
// TODO: remove the need to specify baseUrl, so other extensions can use this network service.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I'm slightly puzzled by this TODO. It sounds like a good idea to me, but it also sounds like hard-coding the baseUrl is currently a working solution, whereas the comment suggests that other extensions can't use the service as long as the baseUrl needs to be specified.

Comment on lines +167 to +169
'fwLiteExtension.entryService',
new EntryService('http://localhost:29348'), // TODO: avoid hard-coding the base URL
'fw-lite-extension.IEntryService',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ The naming inconsistency here is a bit curious. It looks like we're specifying the object ID and the object type. So, they're fairly different. But maybe it's still desirable to still standardize the "namespace" to e.g. fw-lite-extension?

@imnasnainaec imnasnainaec force-pushed the pb-ext-readme-drop-into-paranext-core branch from 613cdfa to fc94842 Compare March 12, 2026 13:39
@imnasnainaec imnasnainaec marked this pull request as draft March 12, 2026 13:49
@imnasnainaec
Copy link
Collaborator Author

imnasnainaec commented Mar 12, 2026

Dropping a bug note here for future investigation:

Sometimes, even when the extension is generally working (e.g., the "Search in FieldWorks..." menu item opens and functions), the "Browse FieldWorks dictionary can fail" with the following in the tab it opens:

Failed to load assets. Failed to fetch dynamically imported module: http://localhost:29348/_content/FwLiteShared/viewer/main.q4p2zef4nb.js TypeError: Failed to fetch dynamically imported module: http://localhost:29348/_content/FwLiteShared/viewer/main.q4p2zef4nb.js

UPDATE: This is when copying the release .zip to paranext-core, but not when copying the dist/ folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants