posit-dev / posit-dev/shinylive
Accepting completions from LSP in some cases leads to invalid syntax
Open
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) -
Code after accepting the suggestion
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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