feat: add language-mode plugin recommendation system#2368
Conversation
Greptile SummaryThis PR adds a language-mode plugin recommendation system: when a file opens as plain text because no syntax mode is installed, Acode checks the plugin API and either suggests an existing plugin (with a "Search plugins" action) or offers a GitHub issue link to request one. The feature is opt-out via a new
Confidence Score: 5/5Safe to merge — the feature is entirely additive, opt-out by default, and the previously flagged bugs have been addressed in this revision. The recommendation engine uses conservative defaults (no notification on network failure, deduplication via pendingKeywords, notifiedKeywords marked only after success), and the extensions sidebar integration guards against uninitialised state via waitForSearchInput. The two remaining observations are edge-case silent failures that do not affect correctness under normal conditions. No files require special attention beyond the two minor edge cases noted in languageModeRecommendations.js and extensions/index.js. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant EF as editorFile.js
participant LMR as languageModeRecommendations.js
participant API as Plugin API
participant NM as notificationManager
participant EXT as extensions/index.js
EF->>EF: setMode(mode, modeInfo)
EF->>LMR: maybeRecommendLanguageModeExtension(file, modeInfo)
Note over LMR: check recommendExtensions setting
LMR->>API: "fetch /plugins?name=keyword"
alt plugins found
API-->>LMR: plugin list
LMR->>NM: pushNotification with Search plugins action
NM-->>EF: toast shown, auto-dismiss 5s
NM->>EXT: openWithSearch(keyword)
EXT->>EXT: waitForSearchInput poll up to 1s
EXT->>EXT: runSearch(keyword)
else no plugins or error
API-->>LMR: empty or failure
LMR->>NM: pushNotification with Request plugin action
NM->>NM: openUrl GitHub issue
end
LMR->>LMR: notifiedKeywords.add(keyword)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant EF as editorFile.js
participant LMR as languageModeRecommendations.js
participant API as Plugin API
participant NM as notificationManager
participant EXT as extensions/index.js
EF->>EF: setMode(mode, modeInfo)
EF->>LMR: maybeRecommendLanguageModeExtension(file, modeInfo)
Note over LMR: check recommendExtensions setting
LMR->>API: "fetch /plugins?name=keyword"
alt plugins found
API-->>LMR: plugin list
LMR->>NM: pushNotification with Search plugins action
NM-->>EF: toast shown, auto-dismiss 5s
NM->>EXT: openWithSearch(keyword)
EXT->>EXT: waitForSearchInput poll up to 1s
EXT->>EXT: runSearch(keyword)
else no plugins or error
API-->>LMR: empty or failure
LMR->>NM: pushNotification with Request plugin action
NM->>NM: openUrl GitHub issue
end
LMR->>LMR: notifiedKeywords.add(keyword)
Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile |
No description provided.