Delete an/inside argument is not working on object attributes on assignment
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
This bug was noticed while programming in TypeScript.
daa and dia should delete object literal attributes like if they were function arguments (including or excluding the commas, respectively)
However, it it doesn't work with object attributes.
To Reproduce
<c> means the cursor is on top of c
1a. Setup
const o = {attr1: "something", a<t>tr2: "something else"}
2a. Press daa
1b. Setup
const o = {attr1: "something", a<t>tr2: "something else"}
2b. Press dia
Expected behavior
After 2a, expected is:
const o = {attr1: "something"}
But we got:
const o = {attr1: "something", a<t>tr2: "something else"}
(Nothing happened)
After 2b, expected is:
const o = {attr1: "something",}
But we got:
const o = {attr1: "something", a<t>tr2: "something else"}
(Nothing happened)
Aditional Context
This situation is also observed with cia and caa
I know the original vim-target plugin does not target things like typescript object attributes.
I wouldn't have opened this issue, if not for the fact that this daaand dia actually work on object attributes in some circumstances eg. when the object is an argument to a function.
Example
<c> means the cursor is on top of c
someFunc({as<d>f1:10,asdf2:15});
Pressing daa in the situation will result in
someFunc(sdf2:15});
Either dia and daa should not work at all on object attributes (which I would not want, since I think it is a very useful feature)
This behaviour is, however, not correct: it is deleting everything (backwards) until the (, which does not make sense in this context.
I will open another issue for this, as I think it is a bug.
Please let me know your thoughts on this.
Contributor guide
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
Start by reproducing the TypeScript object-literal cases with daa, dia, cia, and caa, then inspect the implementation and tests for these text objects and argument targets. Done means object attributes are handled consistently: deletion should remove the selected attribute with the expected comma behavior, without deleting back to the surrounding function call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100