Git Product home page Git Product logo

Comments (4)

PhilippSalvisberg avatar PhilippSalvisberg commented on May 28, 2024

I guess you are using different settings. With the latest settings for SQLDev 20.2 the result is the following:

   FUNCTION get_id1 (
      p_1  NUMBER,
      p_2  NUMBER,
      p_3  NUMBER
   ) RETURN NUMBER IS
      local_1  NUMBER;
      local_2  NUMBER;
      local_3  NUMBER;
      local_4  NUMBER;
      local_5  NUMBER;
   BEGIN
      RETURN 9999;
   END get_id1;
   FUNCTION get_id2 (
      p_1  my_table.id%TYPE,
      p_2  my_table.id%TYPE,
      p_3  my_table.id%TYPE
   ) RETURN my_table.id%TYPE IS
      local_1  my_table.id%TYPE;
      local_2  my_table.id%TYPE;
      local_3  my_table.id%TYPE;
      local_4  my_table.id%TYPE;
      local_5  my_table.id%TYPE;
   BEGIN
      -- some code
      RETURN 9999;
   END get_id2;

from plsql-formatter-settings.

krokyk avatar krokyk commented on May 28, 2024

Yes you are right, there are 2 settings I changed

  1. indentation from 3 to 4 spaces (this alone doesn't make a difference)
  2. and in Line Breaks - After statements changed from Single to Double Break

The (2) is essential as I want to have empty lines between individual functions and procedures. Once I change that, new line is added after IS

CREATE OR REPLACE PACKAGE BODY abc AS

    FUNCTION get_id1 (
        p_1  NUMBER,
        p_2  NUMBER,
        p_3  NUMBER
    ) RETURN NUMBER IS
        local_1  NUMBER;
        local_2  NUMBER;
        local_3  NUMBER;
        local_4  NUMBER;
        local_5  NUMBER;
    BEGIN
        RETURN 9999;
    END get_id1;

    FUNCTION get_id2 (
        p_1  my_table.id%TYPE,
        p_2  my_table.id%TYPE,
        p_3  my_table.id%TYPE
    ) RETURN my_table.id%TYPE IS

        local_1  my_table.id%TYPE;
        local_2  my_table.id%TYPE;
        local_3  my_table.id%TYPE;
        local_4  my_table.id%TYPE;
        local_5  my_table.id%TYPE;
    BEGIN
      -- some code
        RETURN 9999;
    END get_id2;

END;

Any suggestion how to achieve this?

from plsql-formatter-settings.

PhilippSalvisberg avatar PhilippSalvisberg commented on May 28, 2024

Thank you for the additional information. Now I can reproduce the behaviour.

The brkX2_1 query handles that. This part of the expression is responsible for the additional, conditional line break:

| [node) is_or_as & [node+1) decl_list & [(node+1)+20 < (node+1)) -- long declarations

I'm going to change the behaviour as follows, if X2 is enabled:

  • never add a new line after as_or_is for PL/SQL units
  • add always a new line after as_or_is for a package specification or package body

from plsql-formatter-settings.

krokyk avatar krokyk commented on May 28, 2024

Thanks for this too. Going to try it soon.

from plsql-formatter-settings.

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.