UniqueVision / plpgsql-lsp

MIT License
50 stars 10 forks source link

Allow stopping of extension processing after comment line #55

Open a-mckinley opened 2 years ago

a-mckinley commented 2 years ago

Is your enhancement related to a problem? Please describe.

Currently, / plpgsql-language-server:disable / is supported to disable extension processing for entire file.

Would it be possible to stop any extension processing beyond the comment as opposed to whole file?

My use case is for a data processing test script like

-- create tables
create table if not exists fake_table (
    id bigint
);
-- create plpgsql functions
create or replace function fake_function() returns void as
$$
 -- do time consuming data processing work
$$ language plpgsql;

-- execute one of these functions
select fake_function();

It would be great to allow the extension to give me feedback as normal on my tables,function definitions, but not execute the function at the bottom.

So if the extension supported:

-- create tables
create table if not exists fake_table (
    id bigint
);
-- create plpgsql functions
create or replace function fake_function() returns void as
$$
 -- do time consuming data processing work
$$ language plpgsql;

/* plpgsql-language-server:disable */
-- execute one of these functions
-- but disable the extension executing statements beyond this line
select fake_function();
yas7010uv commented 2 years ago

@a-mckinley

It is possible.

The concern is that the user may be confused as to whether to disable the entire subsequent file or only the following statement.

Perhaps an option to disable the following statement should be provided at the same time

/* plpgsql-language-server@statement:disable */

Also, I believe this issue is connected to #12 where we wanted to control by comments.

I am waiting for a parser to interpret comments, but perhaps I should include own processing.

In any case, I don't have time right now to get into this issue right away.

yas7010uv commented 1 year ago

@a-mckinley

We have released v2.10.0.

In this release, it is possible to perform validation on each statement divided by comments and set the disable flag for each statement.

Please see this sample.

If this feature works for your purposes, please close this PR. If not, please provide an additional description of the feature you really want.

yas7010uv commented 1 year ago

@a-mckinley

Please also refer to the following

https://github.com/UniqueVision/plpgsql-lsp#multiple-statements