← 输入框|github.com|刷新
Skip to content

Code reference with object type #960

Closed

Description

@PhilippSalvisberg

Is your feature request related to a problem? Please describe.

In the SQL Developer extension I create hyperlinks for code references in warnings, errors and serveroutput reported by the realtime reporter. Code references are detected by the following regular expressions:

  • \s+("(\S+?)\.(\S+?)(?:\.(\S+?))?",\s+line\s+([0-9]+))
    examples (with line as used by Oracle):

    • at "OWNER.PACKAGE.PROCEDURE", line 42
    • at "OWNER.PROCEDURE", line 42
    • at "OWNER.PACKAGE", line 42
  • ^\s{2}((\S+?)\.(\S+?)\.(\S+?))$
    example (without line, as used for commit/rollback warning, line is calculated via source lookup and parse):

    • owner.package.procedure

Via a click on the hyperlink the referenced code line is opened in the associated editor.

The problem is, that I cannot distinguish between references to aPACKAGE SPECIFICATION and a PACKAGE BODY. This information is simply missing. I do a dictionary lookup to identify the type. But if there is a SPEC and a BODY, then I go for the BODY, which is not always correct (e.g. for warnings regarding ignored annotations).

Describe the solution you'd like

I suggest to keep the existing references as is, if they are referring a PACKAGE BODY or an UNKOWN TYPE (e.g. via Oracle error stack). But for warnings which are known to be for a SPECIFICATION I suggest to extend the code reference as follows:

at package "OWNER.PACKAGE", line 42

for bodies the reference does not need to be changed, we may keep it as today:

at "OWNER.PACKAGE", line 42

Describe alternatives you've considered

There are many ways one could tag a specification, of course. However, I would change only the representation for specifications and keep the format for all other code references to minimize the impact for users working with an older version of the utPLSQL framework. This way the SQL Developer extension will still identify the hyperlink. It will open the body instead of the spec (sometimes), but that's better than no hyperlink at all or maintaining many variants of code reference formats in the SQL Developer extension.

Additional context

Here's a screenshot:

image

Activity

  1. PhilippSalvisberg commented on Jul 1, 2019

    @PhilippSalvisberg
    MemberAuthor

    I extend the existing regular expression in the SQL Developer extension to cover the optional package tag before the qualified object name (e.g. at package "OWNER.PACKAGE", line 42). This way the hyperlink will correctly point to the specification when a newer version of the utPLSQL framework is used.

  2. jgebal commented on Jul 1, 2019

    @jgebal
    Member

    I like the proposed solution.
    It will minimize thr impact on both consumers as well as framework itself.

  3. added a commit that references this issue on Jul 2, 2019
    e2ff899
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions