Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create TypeSpec Project Failed #1

Open
xiaohua899 opened this issue Jan 6, 2025 · 8 comments
Open

Create TypeSpec Project Failed #1

xiaohua899 opened this issue Jan 6, 2025 · 8 comments

Comments

@xiaohua899
Copy link
Owner

xiaohua899 commented Jan 6, 2025

Description
Failed to create TypeSpec Project. The error message is as follows:

image

Repro steps

  1. Install the typespec extension.

    image
    image

  2. Typing >TypeSpec: Create TypeSpec Project in the Command Palette.
    image

  3. Select an empty folder as the root folder for the new TypeSpec project.

    image

  4. Select a template.

    image

Environment

  • TypeSpec for VS Code version: 0.63.0
  • OS: Windows

Expected behavior

A prompt Select a template will appear, and you should see four options: Empty Project, Generic REST API, TypeSpec Library (with TypeScript), TypeSpec Emitter (with TypeScript).

image

@msyyc for notification.

@msyyc
Copy link

msyyc commented Jan 7, 2025

The error had better add suggestion command for users to upgrade compiler version.

@msyyc
Copy link

msyyc commented Jan 7, 2025

@xiaohua899 It will be fixed after public release so please try the following workaround.
image
image

@xiaohua899
Copy link
Owner Author

xiaohua899 commented Jan 7, 2025

@msyyc After installing @typespec/compiler@next, when creating TypeSpec project, the initialize project will fail, as follows:

image

Step

  1. Install the typespec extension.
  2. Install @typespec/compiler@next.
  3. Create TypeSpec Project.

@RodgeFu
Copy link

RodgeFu commented Jan 8, 2025

@msyyc After installing @typespec/compiler@next, when creating TypeSpec project, the initialize project will fail, as follows:

image

Step

  1. Install the typespec extension.

  2. Install @typespec/compiler@next.

  3. Create TypeSpec Project.

Feels you are not using latest code. Where did you get the vsix? Please make sure it includes the latest code from typespec main

@msyyc
Copy link

msyyc commented Jan 8, 2025

@xiaohua899 Please follow @RodgeFu's suggestion to try latest .vsix built from https://github.com/microsoft/typespec/tree/main.

nit: how to build .vsix locally:

PS C:\dev > git clone https://github.com/microsoft/typespec.git
PS C:\dev > cd typespec
PS C:\dev\typespec > cd packages\typespec-vscode
PS C:\dev\typespec\packages\typespec-vscode > pnpm package-vsix

@xiaohua899
Copy link
Owner Author

@msyyc We successfully built the .vsix file from https://github.com/microsoft/typespec/tree/main and created the typespec project.

We have a few questions to confirm with you, as follows:

  1. After installing the latest build of the .vsix file, the Typespec: Generate form TypeSpec command is missing.
    image

  2. When running Typespec: Create TypeSpec Project, the prompt for Select libraries to install or update only appears after selecting Generic REST API(min Compiler ver: 0.63.0).
    For Empty project, TypeSpec Library (With TypeScript), and TypeSpec Emitter (With TypeScript), no such prompt appears. Is this the expected result?
    image

  3. We still need to install @typespec/compiler@next, otherwise an error will be reported:
    image

Steps:

  1. Built the .vsix file,
git clone https://github.com/microsoft/typespec.git
cd typespec
npm install -g pnpm
pnpm install
pnpm build
cd packages\typespec-vscode
pnpm package-vsix
  1. Install the .vsix file.
  2. Install compiler npm install -g @typespec/compiler@next.
  3. Create TypeSpec Project.

@RodgeFu
Copy link

RodgeFu commented Jan 9, 2025

5. eate TypeSpec Project.

  1. you need to use package from this PR Generate Code from TypeSpec in VSCode microsoft/typespec#5312 which contains both feature.
  2. it should be expected, but please compare with "tsp init" command to double check
  3. yes, we need to use @next version until 0.64 is released. thx.

@xiaohua899
Copy link
Owner Author

@RodgeFu Thanks for your reply.

  1. The .vsix file built from the package in Generate Code from TypeSpec in VSCode microsoft/typespec#5312 contains these two functions.
  2. It is as expected, we compared with the "tsp init" command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants