posit-dev / posit-dev/positron

diagnostics should show less aggressively when typing code in an editor

Open
#979 14 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area: core area: diagnostics sharp-edge
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

At least in Python, we currently have a very happy trigger finger with showing diagnostics (both in the console and in the source editor, though we're dealing with the console in a separate issue #1114). For example, if you simply enter this:

>>> x = 

You will get a red underline indicating an "error" in your code:

Screen Shot 2023-08-08 at 1 49 04 PM

Especially for less experienced developers I think this will be at best annoying and at worst provoke users to actually figure out "what's wrong" with the code they just entered.

I think we need a fancier set of heuristics for when to show diagnostics around active edits. One thing I've seen work well is to never show diagnostics on the line where the cursor currently is. We could also never show diagnostics if the current line is empty. Another thing we could do is have diagnostics run debounced over a longer period (e.g. 3 seconds). The goal is to never mis-detect and incomplete edit as an error or warning.

We'll need to play around with different strategies in order to get this just right.

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

Reproduce the Python x = example in the source editor and inspect the diagnostic behavior during active edits; the issue names no implementation file or test. Done means agreeing on and validating heuristics that avoid treating incomplete edits as errors, including the cursor line or empty lines, with any debounce behavior tested against the editor experience.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.