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

fix(autoedit): fix suffix matching logic #6171

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

valerybugakov
Copy link
Member

Fixes the issue where the inline completion item provider is used in cases where chars deletions are required after the cursor because of the incorrect suffix matching logic.

Test plan

Manually tested by renaming the attributes to values in the following code and placing the cursor on the const { currentLinePrefix, text, ...rest } = values line:

export const addAutocompleteDebugEvent = (
    name: string,
    attributes: Record<string, unknown> = {}
): Span | undefined => {
    if (process.env.NODE_ENV === 'development') {
        const activeSpan = trace.getActiveSpan()

        const { currentLinePrefix, text, ...rest } = attributes
        if (typeof currentLinePrefix === 'string' && typeof text === 'string') {
            const formattedText = `${currentLinePrefix}${text.trimStart()}`
            return activeSpan?.addEvent(name, { text: formattedText, ...rest })
        }

        return activeSpan?.addEvent(name, attributes as Attributes)
    }
    return undefined
}

Currently, we don't have automated tests for the renderer and provider. We plan to implement them early next week

@valerybugakov valerybugakov merged commit 7cd1fd1 into main Nov 21, 2024
19 of 21 checks passed
@valerybugakov valerybugakov deleted the vb/autoedit-suffix-match-fix branch November 21, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants