language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

AutoCompletions show up even without preview feature enabled

Open janpio opened this issue 4 years ago • 6 comments

This should only show up with previewFeatures = ["referentialActions"] in the schema file:

image

Note: referentialActions is now GA so this example is outdated

janpio avatar Jun 29 '21 18:06 janpio

Note: Need to figure out how best get the value of the previewFeatures array here, either via the Engine somehow or via a dirty regex on the schema file content.

janpio avatar Jul 06 '21 16:07 janpio

Relates to https://github.com/prisma/language-tools/issues/818 Difficult to know how much work there is for now but we should look into it.

thebiglabasky avatar Aug 11 '21 09:08 thebiglabasky

Not relevant for referentialActions GA as making that feature go GA, will remove the problem as there will be no more preview feature for it.

This issue is more general - the VSCode extension can not use preview feature flags or datasource.provider values to inform its auto completion right now at all. This will need to be solved by somehow parsing the schema file and using these values to inform the auto completion process.

(This might be simpler in the future when the Formatter binary is not more but we can use a Webassembly module that provides this functionality, that can rely on the Rust side parsing of the schema file that already exists.)

janpio avatar Aug 13 '21 17:08 janpio

ReferentialActions are GA, so this is not a problem anymore.

tomhoule avatar Sep 23 '21 09:09 tomhoule

The problem itself unfortunately is not fixed by this one feature going GA: There is no way to have auto completions only when specific preview features are enabled.

janpio avatar Sep 23 '21 19:09 janpio

We now have a way to filter on previewFeatures flags with https://github.com/prisma/language-tools/blob/main/packages/language-server/src/completion/completions.ts#L337-L366

Added in https://github.com/prisma/language-tools/commit/9751628bc4af86c50bc2361553507affa04981da

Jolg42 avatar Mar 15 '22 15:03 Jolg42