Repository: microsoft/TypeScript
File: src/harness/client.ts (TypeScript)

Code before:
            : identity<RenameInfoFailure>({ canRename: false, localizedErrorMessage: body.info.localizedErrorMessage });
        this.lastRenameEntry = {
            renameInfo,
            inputs: {
                fileName,
                position,
                findInStrings: !!findInStrings,
                findInComments: !!findInComments,
            },
            locations,
        };
        return renameInfo;
    }

    getSmartSelectionRange() {
        return notImplemented();
    }

    findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences): RenameLocation[] {
        if (!this.lastRenameEntry ||
            this.lastRenameEntry.inputs.fileName !== fileName ||
            this.lastRenameEntry.inputs.position !== position ||
            this.lastRenameEntry.inputs.findInStrings !== findInStrings ||
            this.lastRenameEntry.inputs.findInComments !== findInComments) {
            const { providePrefixAndSuffixTextForRename } = preferences;
            if (providePrefixAndSuffixTextForRename !== undefined) {
                // User preferences have to be set through the `Configure` command
                this.configure({ providePrefixAndSuffixTextForRename });
                // Options argument is not used, so don't pass in options
                this.getRenameInfo(fileName, position, /*preferences*/{}, findInStrings, findInComments);
                // Restore previous user preferences
                if (this.preferences) {
                    this.configure(this.preferences);
                }
            }
            else {
                this.getRenameInfo(fileName, position, /*preferences*/{}, findInStrings, findInComments);
            }
        }

        return this.lastRenameEntry!.locations;
    }

    private decodeNavigationBarItems(items: protocol.NavigationBarItem[] | undefined, fileName: string, lineMap: number[]): NavigationBarItem[] {
        if (!items) {
            return [];
        }

        return items.map(item => ({
            text: item.text,
            kind: item.kind,

Review comment (suggestion):
Not sure if I should also have a check for `quotePreference` here. IIRC the harness is for testing purposes so I thought it didn't matter (?)

Code after:
            : identity<RenameInfoFailure>({ canRename: false, localizedErrorMessage: body.info.localizedErrorMessage });
        this.lastRenameEntry = {
            renameInfo,
            inputs: {
                fileName,
                position,
                findInStrings: !!findInStrings,
                findInComments: !!findInComments,
            },
            locations,
        };
        return renameInfo;
    }

    getSmartSelectionRange() {
        return notImplemented();
    }

    findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences | boolean | undefined): RenameLocation[] {
        if (!this.lastRenameEntry ||
            this.lastRenameEntry.inputs.fileName !== fileName ||
            this.lastRenameEntry.inputs.position !== position ||
            this.lastRenameEntry.inputs.findInStrings !== findInStrings ||
            this.lastRenameEntry.inputs.findInComments !== findInComments) {
            const providePrefixAndSuffixTextForRename = typeof preferences === "boolean" ? preferences : preferences?.providePrefixAndSuffixTextForRename;
            const quotePreference = typeof preferences === "boolean" ? undefined : preferences?.quotePreference;
            if (providePrefixAndSuffixTextForRename !== undefined || quotePreference !== undefined) {
                // User preferences have to be set through the `Configure` command
                this.configure({ providePrefixAndSuffixTextForRename, quotePreference });
                // Options argument is not used, so don't pass in options
                this.getRenameInfo(fileName, position, /*preferences*/{}, findInStrings, findInComments);
                // Restore previous user preferences
                if (this.preferences) {
                    this.configure(this.preferences);
                }
            }
            else {
                this.getRenameInfo(fileName, position, /*preferences*/{}, findInStrings, findInComments);
            }
        }

        return this.lastRenameEntry!.locations;
    }

    private decodeNavigationBarItems(items: protocol.NavigationBarItem[] | undefined, fileName: string, lineMap: number[]): NavigationBarItem[] {
        if (!items) {
            return [];
        }

        return items.map(item => ({
            text: item.text,