Skip to content

Why does ark provide so many completions, all the time? #900

@juliasilge

Description

@juliasilge

I've been doing some debugging and exploration of completions in partnership with @vezwork, with the goal of getting completions in the visual editor working. It is very clear there is work to do in the visual editor itself, in terms of filtering and sorting completions.

However, at the same time, we are noticing something strange about the completions that ark provides in Positron for R. It seems like the set of completions provided is always basically the same, and always... almost all possible completions?

Here are some steps to see what I mean:

Setup

Set up a dev build of Positron with a breakpoint in src/vs/editor/contrib/suggest/browser/suggestModel.ts, and change what happens around line 504 so that you can await and see the resulting completions, like this:

		const completions = await provideSuggestionItems(
			this._languageFeaturesService.completionProvider,
			model,
			this._editor.getPosition(),
			completionOptions,
			suggestCtx,
			this._requestToken.token
		);

Set the breakpoint so you can check out what gets returned in completions.

Python

Explore what happens with some simple Python completions, after doing something like import os:

  • With os. you get 377 completions, all of which are real things you can do in that namespace
  • With os.c you get 16 completions (a subset)
  • With os.ch you get 5 completions (a smaller subset)

R

Explore what happens with some simple R completions, with just base R things:

  • With lib, you get 2928 completions, which look like basically every single thing that could possible be provided as a completion for the packages I have installed
  • With librar, it is still all 2928 completions
  • With lm, it is now 2929 completions 🤪

And so forth.

What might be going on here? This is definitely not urgent, but it can't be helping us performance-wise to be shuttling around every single completion every single time, right? Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions