VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.97k stars 1.32k forks source link

Delete an/inside argument is not working on object attributes on assignment #7019

Open giluis opened 3 years ago

giluis commented 3 years ago

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.

elazarcoh commented 3 years ago

Hi, Please try to configure:

"vim.argumentObjectClosingDelimiters": [
        ")",
        "]",
        "}"
    ],
    "vim.argumentObjectOpeningDelimiters": [
        "(",
        "[",
        "{"
    ],

Hopefully it's what you're looking for