Coder Social home page Coder Social logo

Comments (4)

alex-hhh avatar alex-hhh commented on August 28, 2024

This is a known issue, and it is not simple to fix. The workaround is to use begin/end blocks around the nested if statements, as in the example below. I pushed a fix for indenting an end if line when there's an elsif in the if-else chain, see deb9885.

Unfortunately, I do not have time to fix this issue. If you want to try fixing it, the problem is that sqlind-beginning-of-statement-1 does not detect the beginning of the statement correctly for nested if blocks, so the sqlind-syntax-of-line function computes an incorrect syntax.

begin
  if 1 = 0 then
    begin
      if 1 = 0 then
        null;
      else
        null;
      end if;
    end;
  elsif 1 = 2
    begin
      if 1 = 0 then
        null;
      else
        null;
      end if;
    end;
  else
    null;
  end if;
end;
/

from emacs-sql-indent.

PierreTechoueyres avatar PierreTechoueyres commented on August 28, 2024

Thanks for the hint. Unfortunately I must work with existing code and I can't enclose If blocks.
I'll try to work on this. Thanks for the start point.

from emacs-sql-indent.

alex-hhh avatar alex-hhh commented on August 28, 2024

After a bit of thinking I think I got this working. Can you please try it out and see if it OK?

I wrote this code about 10 years ago and back than this seemed like a hard task...

from emacs-sql-indent.

PierreTechoueyres avatar PierreTechoueyres commented on August 28, 2024

Whaou, You're faster than light !!!
Many thanks for fixing this. And you've maybe wrote this code 10 years ago but it's always useful (at least for me).

from emacs-sql-indent.

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.