Skip to content

fix: skip recommendation for binary file#2446

Merged
bajrangCoder merged 1 commit into
mainfrom
fix/dont-recommend-binary
Jul 4, 2026
Merged

fix: skip recommendation for binary file#2446
bajrangCoder merged 1 commit into
mainfrom
fix/dont-recommend-binary

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a single guard in maybeRecommendLanguageModeExtension to bail out early when the opened file is a binary, preventing the language-mode extension recommendation dialog from popping up for images, archives, and other binary file types.

  • A single-line early return using helpers.isBinary(file.filename || file.uri) is inserted after the existing mode-name/supportsFile guard in src/lib/editorFile.js.
  • The fix relies on extension-based binary detection (isBinaryPath), consistent with how helpers.isBinary is used elsewhere in the codebase (e.g., openFile.js, searchInFiles/index.js).

Confidence Score: 5/5

Safe to merge — the change is a one-line early return that prevents an irrelevant UI dialog from appearing when a binary file is opened.

The guard uses the same helpers.isBinary helper already exercised in openFile.js and searchInFiles, passes the correct string value (file.filename || file.uri) consistent with the function's string-path branch, and is inserted at the right point in an otherwise-unchanged control flow. No existing paths are altered, and the fallback when both fields are absent is a safe no-op (returns false, preserving prior behavior).

No files require special attention.

Important Files Changed

Filename Overview
src/lib/editorFile.js Adds a binary-file guard in maybeRecommendLanguageModeExtension; consistent with existing usage of helpers.isBinary elsewhere in the codebase.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["maybeRecommendLanguageModeExtension(file, modeInfo)"] --> B{recommendExtensions\nenabled?}
    B -- No --> Z[return early]
    B -- Yes --> C{isInitialPluginLoad\nComplete?}
    C -- No --> Z
    C -- Yes --> D{modeInfo.name === 'text'\nAND NOT supportsFile?}
    D -- No --> Z
    D -- Yes --> E{helpers.isBinary\nfile.filename OR file.uri}
    E -- true\nbinary file --> Z
    E -- false\nnot binary --> F[import languageModeRecommendations]
    F --> G[recommend extension to user]
Loading
%%{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"}}}%%
flowchart TD
    A["maybeRecommendLanguageModeExtension(file, modeInfo)"] --> B{recommendExtensions\nenabled?}
    B -- No --> Z[return early]
    B -- Yes --> C{isInitialPluginLoad\nComplete?}
    C -- No --> Z
    C -- Yes --> D{modeInfo.name === 'text'\nAND NOT supportsFile?}
    D -- No --> Z
    D -- Yes --> E{helpers.isBinary\nfile.filename OR file.uri}
    E -- true\nbinary file --> Z
    E -- false\nnot binary --> F[import languageModeRecommendations]
    F --> G[recommend extension to user]
Loading

Reviews (1): Last reviewed commit: "fix: don't recommend for binary file" | Re-trigger Greptile

@bajrangCoder bajrangCoder changed the title fix: don't recommend for binary file fix: skip recommendation for binary file Jul 4, 2026
@bajrangCoder bajrangCoder merged commit 1c9ad53 into main Jul 4, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Jul 4, 2026
@bajrangCoder bajrangCoder deleted the fix/dont-recommend-binary branch July 4, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant