posit-dev / posit-dev/shinylive

Accepting completions from LSP in some cases leads to invalid syntax

Open
#209 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
251
Forks
25
Avg merge
19m
Merged PRs (30d)
2

Description

I came across a peculiar scenario at https://shinylive.io where the code edits made after accepting a LSP completion item is incorrect.

import random
import typing as t

myfunc: t.Callable[[], t.Literal['yes', 'no']] = lambda: random.choice(['yes', 'no'])

if myfunc() == '  # autocomplete is triggered here

Suggestions from LSP (as expected) -

Image

Code after accepting the suggestion

Image

Contributor guide

No contributing guide indexed for this repository

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 completion flow at shinylive.io using the Python example and compare the LSP suggestion with the invalid code inserted after acceptance. Trace the completion-handling entry point and verify that accepting the suggestion preserves valid syntax for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.