Giter VIP home page Giter VIP logo

Comments (5)

thomas-hiron avatar thomas-hiron commented on September 28, 2024

Ping @gbprod, maybe you could bring some context to this issue. Did you look into indenting already? Did you have some issues? Thanks!

from nvim-treesitter.

clason avatar clason commented on September 28, 2024

Having multiple parsers for the same file is not supported. If you have multiple languages, you need to either define a "base language" with injections, or have an "extended" language that inherits from the base language (without injections), as in cpp from c or terraform from hcl (or vice versa).

from nvim-treesitter.

lucario387 avatar lucario387 commented on September 28, 2024

Would need to fix indent to accept the smallest range, instead of the smallest root tree

I don't know how to do that though :). PR Welcome

from nvim-treesitter.

thomas-hiron avatar thomas-hiron commented on September 28, 2024

Oh I see, thanks!
I tried to extends tree-sitter-html but I had too much trouble with externals (scanner.c), and it seems I couldn't add new rules. I felt like I was wasting time.
If it's the correct way to go, I'll give it another shot then.

@clason can I define injections for indents? The upstream plugin is already configured for highlights for example.

Thanks for your help!

EDIT: I didn't understand injections, injections.scm is responsible for incorrect indenting:

((content) @injection.content
 (#set! injection.language "html")
 (#set! injection.combined))

Without this, twig indenting works! How can I apply my indent rules when twig is inside a html block?

from nvim-treesitter.

gbprod avatar gbprod commented on September 28, 2024

Ping @gbprod, maybe you could bring some context to this issue. Did you look into indenting already? Did you have some issues? Thanks!

Hi!
I've never tried to make indentation works for twig (mostly because I don't know how to make it works with combined injection).
But it would be awesome to improve this :)
I will make some tests ;)

from nvim-treesitter.

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.