Giter Site home page Giter Site logo

Comments (8)

mickeynp avatar mickeynp commented on June 20, 2024

Hey there. That's definitely possible, and not just in the jsx nodes: try C-M-d and C-M-u.

from combobulate.

phuhl avatar phuhl commented on June 20, 2024

Hey, thanks for the response.

When there are no attributes with ={} in the tag, it seems to work (ish) but with (non string) attributes it behaves very different for me:

|<div className={foo}>
      <p className={bar}>Text</p>
 </div>

C-M-d

<div className=|{foo}>
      <p className={bar}>Text</p>
</div>

C-M-d

<div className={|foo}>
      <p className={bar}>Text</p>
</div>

C-M-d

<div className={foo}|>
      <p className={bar}>Text</p>
</div>

C-M-d

<div className={foo}>
      <p className={|bar}>Text</p>
</div>

from combobulate.

mickeynp avatar mickeynp commented on June 20, 2024

There are some liberties taken with the definition of moving down. Namely, it tries to mimic the default Emacs behaviour of C-M-d (in the last example anyway) where C-M-d will always jump into the next pair of brackets, regardless of where it is in the structure, if it can't think of anywhere else to go, or if they are closer than another node that is not a direct descendant.

The other liberty is that C-M-d will try its best to always have somewhere to move to. It's not perfect: but the alternative is that you'll wind up entering lots of 'dead ends' in the tree, which is all too easy to do. (Try M-x treesit-explore-mode to see what the tree actually looks like.)

from combobulate.

mickeynp avatar mickeynp commented on June 20, 2024

I should definitely document this behaviour better though.

from combobulate.

phuhl avatar phuhl commented on June 20, 2024

I see. The issue I have in my example from above is, that you don't ever end up with |<p> (i.e. I never end up of the child I wanted to ascend to). Also if you have lot's of attributes, it takes a lot of time and attention to go to the inner tag. Could there maybe be a dedicated function to navigate explicitly sexp (is that the right name for xml tags in this case? 😆) up and down?

from combobulate.

phuhl avatar phuhl commented on June 20, 2024

Actually, when I think about it, this is not really limited to XML nodes. It is great to have the behavior as is. But it would be great to also have hierarchical up/down for bigger code structures. I.e.:

  • the example from above
  • moving into function bodies instead of the params
|const test = (bla) => {
   console.log("test");
};
const test = (bla) => {
  |console.log("test");
};

from combobulate.

phuhl avatar phuhl commented on June 20, 2024

Hey, me again. I have been working a lot more on TS React code and I am really missing this feature where I can move inside any XML Tag (with Inside I mean, directly after the opening tag closes) and so on.

I totally get that you time is constrained. Sadly my lisp is not the greatest, but maybe you could point me a bit to where best to implement such a behavior and I could give it a go?

from combobulate.

mickeynp avatar mickeynp commented on June 20, 2024

Fixed, as this is specifically one of the things the new navigation DSL resolves.

from combobulate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.