language-tools
language-tools copied to clipboard
AutoCompletions show up even without preview feature enabled
This should only show up with previewFeatures = ["referentialActions"] in the schema file:

Note: referentialActions is now GA so this example is outdated
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.
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.
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.)
ReferentialActions are GA, so this is not a problem anymore.
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.
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