Git Product home page Git Product logo

Comments (3)

PhilippSalvisberg avatar PhilippSalvisberg commented on May 28, 2024

Indentation of comments

The indentation is never changed. There is one exception. When you set "Line Breaks Before line comments". In this case, after processing the Arbori programm, the post-processor in SQLDev's formatter adds a new line with some indentation (which is not always correct).

It's not foreseen in SQLDev to format comments. Comments are not part of provided parse-tree. Therefore you cannot query them with Arbori. Of course there are options (where you do the parsing yourself). But for the time being comment indentation handling is not a provided feature. You can place one or more comments before and after every single token. Formatting them without a proper context (provided by a parse-tree) is very very challenging.

As a result all requests/issues regarding comments are rejected. Comments are processed with the default logic of SQL Developer. If you'd like to change that, then I suggest to submit a change request for SQL Developer or discuss it in the SQL Developer's forum.

Empty Lines

The preference is called internally extraLinesAfterSignificantStatements. So the name in the UI Line Breaks After statements is a bit misleading.

The Query brkX2 defines the "significant" statements. I understand that it is wanted to add an empty line after "as/is" for a package or package body to separate the first unit like the subsequent ones. But for the declare section in general? If you do that then you should also add a new line after the "as/is" of a function/procedure, right?

I'm not ready to change that.

However, If you want to add it in your Arbori file variant. Look for brkX2_1 and add this line:

| [node) 'DECLARE'

BTW: the brkX2 query is also responsible to identify the statements where an empty line is preserved (beside empty lines around comments).

However, I agree that the current definition might not be consistent (e.g. an empty line is added before END of a package but not before the end of a package body). But these would be separate issues.

Therefore I close this issue.

from plsql-formatter-settings.

krokyk avatar krokyk commented on May 28, 2024

Fair enough :) Re empty line, I actually don't like the empty line after that package body (i.e. on line 19 in that comparison screenshot) and I would prefer not having it, just like after the declare. So for my purposes I just commented out this line from arbori:

-- | [node) is_or_as & ([node^) pkg_body | [node^) pkg_spec)  -- salvisberg: added to solve issue #12 unconditional break after is_or_as of pkg_body/pkg_spec

from plsql-formatter-settings.

PhilippSalvisberg avatar PhilippSalvisberg commented on May 28, 2024

Yes, a lot of personal preferences are involved here.

Therefore I would like to switch back to "Preserve Original" as default as soon as the remaining problems (wrong indent, unwanted new lines) are solved. This requires corrections in the SQLDev code, which means that this will not be before 20.4.

With "Preserve Original" it would be nice to be able to add more optional empty lines. Based on this we could declare some additional "significant" statements. The side effect would be that "Double break" becomes less attractive.

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.