posit-dev / posit-dev/ark

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

Open
#900 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
337
Forks
32
Avg merge
8d 17h
Merged PRs (30d)
11

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the completion request around line 504 of src/vs/editor/contrib/suggest/browser/suggestModel.ts and reproduce the Python and R examples while inspecting completions. Compare how Ark responds as the typed prefix changes; done means the cause of R returning nearly all completions is identified and the intended completion behavior is documented or actionable.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.