prisma/language-tools

`Generate` codelens fails on Windows

janpio opened this issue · 2 comments

Using the new Generate thing over generator client leads to this for me:

Running prisma generate:
- /C:/Users/Jan/Documents/throwaway/19963
- (cd /C:/Users/Jan/Documents/throwaway/19963 && npx prisma generate)
Command failed: (cd /C:/Users/Jan/Documents/throwaway/19963 && npx prisma generate)
The filename, directory name, or volume label syntax is incorrect.

image

Quick look at the code:

  1. const rootPath = vscode.workspace.workspaceFolders?.[0].uri.path
    seems to include that leading slash, which will cd fail.
  2. https://github.com/prisma/language-tools/blob/9fef22bbe9994e898c54ce6ac7e083b4d445086a/packages/vscode/src/CodeLensProvider.ts#L86C32-L86C34 uses &&, which does not exist on Windows+PowerShell:
> cd C:/Users/Jan/Documents/throwaway/19963 && npx prisma generate  
At line:1 char:43
+ cd C:/Users/Jan/Documents/throwaway/19963 && npx prisma generate
+                                           ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

So I guess we need a better way to get the path for Windows, and then to run both commands consecutively.