Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to ignore specific words #135

Open
moshfeu opened this issue Dec 24, 2023 · 2 comments
Open

Allow to ignore specific words #135

moshfeu opened this issue Dec 24, 2023 · 2 comments
Labels
keep Keep this issue

Comments

@moshfeu
Copy link
Owner

moshfeu commented Dec 24, 2023

A feature request is to have a set of strings to ignore.
For example, setting ignore_strings [ "dev","staging","prod"] would assist with comparing code between configuration files dev, staging, and prod folders.

Source: https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders&ssr=false#review-details

@moshfeu
Copy link
Owner Author

moshfeu commented Jan 4, 2024

It may be possible to consider 2 files as identical if the only differences are strings in the ignore_strings. It won't be possible to not highlighting them in the diff view if there are more differences in these files.

So, if the only differences are the strings in the ignore_strings, the files would appear in the "identical" view and not in the "differences" but if there are more differences, the strings in the ignore_strings will be highlighted alongside the other differences.

Why? because the diff view is vscode's built in and I don't know a way to ask it not to highlight a difference

What do you think @markklemm?

@moshfeu
Copy link
Owner Author

moshfeu commented Jan 4, 2024

@gliviu what do you think? Does it make sense to add this option to the dir-compare or is it better vscode-compare-folders extension to implement it as a compareFileSync handler? If the second option, is it possible to somehow adding a hook into the lineBasedCompareSync so consumers won't have to handle the side effects, the concurrent files reading etc.?
By hook I mean to allow consumer to enrich the lines comparing here, something like

function compareLine(options: Options, line1: string, line2: string, options: Options): boolean {
    if (options.ignoreLineEnding) {
        line1 = trimLineEnding(line1)
        line2 = trimLineEnding(line2)
    }
    if (options.ignoreWhiteSpaces) {
        line1 = trimSpaces(line1)
        line2 = trimSpaces(line2)
    }
    if (options.ignoreAllWhiteSpaces) {
        line1 = removeSpaces(line1)
        line2 = removeSpaces(line2)
    }
    return line1 === line2 || options.customLineComparer(line1, line2);
}

@moshfeu moshfeu added the keep Keep this issue label Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep Keep this issue
Projects
None yet
Development

No branches or pull requests

1 participant