<commit_before>'use strict'

import * as vscode from 'vscode'
import {
    window,
    Position,
    Range,
    Selection,
    QuickPickItem,
    TextEditor,
    commands,
} from 'vscode'


import * as R from 'ramda'

export function activate(context: vscode.ExtensionContext) {

    const goToWord = vscode.commands
        .registerCommand('goToWord.find', () => {
            const editor = window.activeTextEditor
            const document = editor.document
            const text = document.getText()

            const allWords: any = R.pipe(
                R.match(/\w+/g),
                R.uniq,
                R.mapObjIndexed((value, key) => ({ label: value })),
                R.values,
            )(text)

            let lastQuery = ''
            const startSelections = editor.selections

            window.showQuickPick(allWords,
                {
                    placeHolder: 'Find word',
                    onDidSelectItem: (value: any) => {
                        moveToWord(value, editor, allWords, text)
                    },
                }).then((value: any) => {
                    if (value) {

                        lastQuery = value.label
                        moveToWord(value, editor, allWords, text)
                        // #Hack. Add selected word into find input
                        commands.executeCommand('actions.find')
                    } else {
                        const line = startSelections[0].start.line
                        scrollToLine(editor, line)
                        editor.selections = startSelections


                    }


                })
        })

    context.subscriptions.push(goToWord)
}

export function deactivate() {
    // empty
}
<commit_msg>Simulate fuzzy search in quickpick<commit_after>'use strict'

import * as vscode from 'vscode'
import {
    window,
    Position,
    Range,
    Selection,
    QuickPickItem,
    TextEditor,
    commands,
} from 'vscode'


import * as R from 'ramda'

export function activate(context: vscode.ExtensionContext) {

    const goToWord = vscode.commands
        .registerCommand('goToWord.find', () => {
            const editor = window.activeTextEditor
            const document = editor.document
            const text = document.getText()

            const allWords: any = R.pipe(
                R.match(/\w+/g),
                R.uniq,
                // #Hack. To simulate fuzzy search in quickpick
                R.mapObjIndexed((value: string, key) => ({ label: value, description: value.toUpperCase().split('').join('i') })),
                R.values,
            )(text)

            let lastQuery = ''
            const startSelections = editor.selections

            window.showQuickPick(allWords,
                {
                    placeHolder: 'Find word',
                    onDidSelectItem: (value: any) => {
                        moveToWord(value, editor, allWords, text)
                    },
                    matchOnDescription: true,

                }).then((value: any) => {
                    if (value) {

                        lastQuery = value.label
                        moveToWord(value, editor, allWords, text)
                        // #Hack. Add selected word into find input
                        commands.executeCommand('actions.find')
                    } else {
                        const line = startSelections[0].start.line
                        scrollToLine(editor, line)
                        editor.selections = startSelections


                    }


                })
        })

    context.subscriptions.push(goToWord)
}

export function deactivate() {
    // empty
}

{'fraction_non_alphanumeric': 0.0959349593495935, 'fraction_numerical': 0.0005420054200542005, 'mean_word_length': 1.337555414819506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6153318', 'n_tokens_mistral': 991, 'n_tokens_neox': 896, 'n_words': 212}