Git Product home page Git Product logo

Comments (6)

PhilippSalvisberg avatar PhilippSalvisberg commented on August 26, 2024

There's a setting called "Identifiers case", but if I change that to lower it will also format the parameters and function/procedure/cursor names.

That's correct. Function names, procedure names, cursor names, variable names, synonym names, table names, view names, column names etc. are all identifiers. So this setting works as expected.

There is no setting to change the case for table/view names only.

from plsql-formatter-settings.

mmunoz-mic avatar mmunoz-mic commented on August 26, 2024

Hi @PhilippSalvisberg, thanks for your response.

Do you know if there's any other way of achieving it?
Using an external tool or something else?

from plsql-formatter-settings.

PhilippSalvisberg avatar PhilippSalvisberg commented on August 26, 2024

Do you know if there's any other way of achieving it?
Using an external tool or something else?

IMO everything is possible. But it's not that easy. In various cases, you cannot distinguish between a view, table, synonym or function. Here's an example:

select * from x;

In this case x can be a table, a view, a synonym or even a function.

If you want to change the case of views and tables only, you need a tooling that provides semantic information such as PL/Scope. So, it's possible. You could even implement that using Arbori by querying the PL/Scope data (if available) from a callback function. However, this would make the formatter unbearable slow.

from plsql-formatter-settings.

PhilippSalvisberg avatar PhilippSalvisberg commented on August 26, 2024

@mmunoz-mic I understand you are using camelCase for function, parameter, and cursor names and would like to preserve them. You would like to change TABLE_1, TABLE_2 and TABLE_3 to lowercase.

What about changing all identifiers to lowercase if they are in uppercase? This could be a single Arbori rule at the end of your formatter. This should produce the result you want. Changing all identifiers to lowercase while preserving existing identifiers in camelCase.

from plsql-formatter-settings.

mmunoz-mic avatar mmunoz-mic commented on August 26, 2024

Hi @PhilippSalvisberg,

Sorry for the late response, I've been out of office.
I understand the implications this would have in performance in the formatter.

I think I can work something out with regex to do the identifier case fix after the formatter.

I'd love to have everything in lowercase but this is used in a corporate environment and camelCase is used for function, parameter, cursor, package and types identifiers.

from plsql-formatter-settings.

PhilippSalvisberg avatar PhilippSalvisberg commented on August 26, 2024

As mentioned before, you can achieve what you want with Arbori. Look at i11_enforce_nonquoted_identifiers that is also updating the token stream. It should be more reliable than a RegEx-based solution because you can easily find relevant identifiers.

We will not include such a feature in the formatter provided in this repo. Therefore I'm closing this issue.

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.