Skip to content

Improved auto suggestions (scoring) for schemas and table names possible? #22

Closed
@Donnerstagnacht

Description

@Donnerstagnacht

Feature request

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

When using the auto suggestions in vs-code, the suggested items after a FROM clause could be improved.

For writing DDL I mosly use AI these days. In my case, the auto suggestion use case which would benefit my productivity the most would be better auto suggestions for schemas and tables since I often fine tune queries by hand.

While not understanding the details from https://supabase.com/blog/postgres-language-server
, I feel that as a user I might feel the impact of the lazy loading, the scoring algorithm and the incompleted statements.

So I would like to describe 3 experiences or improvement wishes from my point of view.

Schema suggestions after FROM clause

Right now, if I type SELECT id FROM or SELECT id FROM g I do not receive schema suggestions. In the first case the AI already predicts a possible schema and table.

Image Image

I think my preferred version would be that a list of all possible schemas (or schemas and tables) is displayed here. I personally mention schemas always explicitly which means that in my case a schema always follows a FROM keyword.

In general, I feel that the tool never detects or suggest schema names.

Does the lazy loading become an issue here? Would be an approach to load all schema names once the extension is loaded? Would be useful to increase the weight of schemas and tables after FROM?

Adding schema automatically when selecting table

If I type SELECT id FROM group_c it suggests the correct table, but if I choose it from the autosuggestions it does not add the schema name and reports an error.

Image Image

My preferred version would be that the tool automatically adds the correct schema.

Suggesting tables after .

Since I think that it does not recognize schemas, I type the schema and add a point. Now it would ideally suggest a table from that schema. However, it seems to load infinitely long.

Image

However, once I add a semicolon, it suggests the correct groups.

Image

Would it be possible to somehow interprete the . and , as semicolon or to trigger the autosuggestions? What does the loading mean? Is it a performance issue? Would it make sense to exclude some schemas from suggestions?

Column suggestion if statement is completed

Often I type SELECT * first or update the returned columns by hand. So I would edit a completed statement like SELECT id FROM groups_hidden.groups;

When I want to add a second column, the tool suggests columns which are not possible in this context because the table is already chosen. I think it could be more restrictive here:

Image

If I type a column name first and add a comma (,), then it suggests columns which are not relevant in my opinion.

Image

In both cases, I would prefer that only columns from the selected table (or tables in joins) are shown. Especially in the last case, it is very likely, that a user would like to choose another column from the current table. Could the weight of columns from the current table be increased?

I was not sure where to add the request (here or in the main repository) and if there is already a technical issue about that in the main repository. If they are, maybe these use cases could be test cases. I believe that these should be common editing workflows.

PS: Thanks for your work! It works great especially to check the quality of AI-generated code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions