Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Include object literals and arrays in javascript + typescript + jsx + tsx queries #93

Open
dylanbyars-komodo opened this issue Apr 19, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dylanbyars-komodo
Copy link

It's easy to get lost in a big nested object literal.

What if we added a new query that records the current key of the object the user is focused inside of? It would be best if the query worked at any level of nesting so an object like

const foo = {
  bar: {
    baz: {
      bip: 'bop' // cursor on this line
    }
  }
}

would return {} foo > {} bar > {} baz > {} bip

I have a version that works for a single level of nesting but wanted to get a sense of whether this is a feature others would use before I dove in to figure out how to make this work at any level of nesting.

@SmiteshP
Copy link
Owner

Hey! I am not that well versed with ts and js, but yeah, this seems like a good idea.

I have a version that works for a single level of nesting but wanted to get a sense of whether this is a feature others would use before I dove in to figure out how to make this work at any level of nesting.

We need a query to work only for one level, the plugin is able to recursively walk up the tree and extract the same pattern again and again. Could you share your treesitter queries?

@SmiteshP SmiteshP added enhancement New feature or request good first issue Good for newcomers labels Apr 23, 2022
@luisiacc
Copy link

I Would totally use this feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants