Skip to content

feat: local word completion#2128

Merged
bajrangCoder merged 4 commits into
Acode-Foundation:mainfrom
bajrangCoder:local-word-completion
May 23, 2026
Merged

feat: local word completion#2128
bajrangCoder merged 4 commits into
Acode-Foundation:mainfrom
bajrangCoder:local-word-completion

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added the translations Anything related to Translations Whether a Issue or PR label May 23, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 23, 2026

Greptile Summary

This PR adds a "local word completion" feature to the Acode editor, which suggests words found in the current file using CodeMirror's built-in completeAnyWord source. It is controlled by a new localWordCompletion setting (defaulting to true) and wired through the existing compartment/applyOptions pattern.

  • New file localWordCompletions.ts: registers completeAnyWord as a completion source via EditorState.languageData.of(), then wraps it in a compartment in editorManager.js that is toggled on/off by the setting.
  • Settings & i18n: localWordCompletion: true added to the defaults in settings.js, a new entry added to editorSettings.js, and both new string keys (\"local word completion\" / \"settings-info-editor-local-word-completion\") added to all 33 language files plus index.d.ts.

Confidence Score: 5/5

Safe to merge — the change adds an opt-out toggle for word completion with no effect on existing code paths.

The new extension follows the established CodeMirror compartment pattern exactly, the setting is correctly wired to the update listener, and all 33 locale files plus the type declaration are updated. No existing behaviour is altered; the feature can be disabled via the new setting.

No files require special attention.

Important Files Changed

Filename Overview
src/cm/localWordCompletions.ts New file: registers completeAnyWord as a languageData completion source via a CodeMirror compartment-compatible Extension. Implementation is minimal and correct.
src/lib/editorManager.js Adds localWordCompletionCompartment and a new cmOptionSpec entry following the established pattern; wires up the update:localWordCompletion event listener. Logic is consistent with liveAutoCompletion and other compartments.
src/lib/settings.js Adds localWordCompletion: true to default settings. Feature is enabled by default for all users.
src/settings/editorSettings.js Adds the localWordCompletion entry to the assistance settings category, consistent with the live autocompletion entry above it.
src/lang/index.d.ts Adds type declarations for the two new string keys and two previously-missing keys (show share button, settings-info-editor-show-share-button). All additions are correct.
src/lang/en-us.json Adds the two new i18n keys in the correct alphabetical positions. All 33 locale files receive the same English fallback strings.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User types in editor] --> B{liveAutoCompletion?}
    B -- true --> C[autocompletion activateOnTyping=true]
    B -- false --> D[autocompletion activateOnTyping=false]
    C --> E{localWordCompletion enabled?}
    D --> F[Manual trigger only]
    F --> E
    E -- true --> G[localWordCompletions Extension\nEditorState.languageData.of\ncompleteAnyWord]
    E -- false --> H[localWordCompletionCompartment = empty]
    G --> I[Suggestions from current file words]
    H --> J[No word suggestions]
    K[appSettings.on update:localWordCompletion] --> L[applyOptions localWordCompletion]
    L --> M[localWordCompletionCompartment.reconfigure]
    M --> E
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread src/lib/editorManager.js Outdated
Comment thread src/settings/editorSettings.js Outdated
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder merged commit e69c369 into Acode-Foundation:main May 23, 2026
7 checks passed
@bajrangCoder bajrangCoder deleted the local-word-completion branch May 23, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants