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

Allow debugging TS code out of the box #87972

Closed
JacksonKearl opened this issue Jan 2, 2020 · 6 comments
Closed

Allow debugging TS code out of the box #87972

JacksonKearl opened this issue Jan 2, 2020 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality typescript Typescript support issues under-discussion Issue is under discussion for relevance, priority, approach
Milestone

Comments

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Jan 2, 2020

We're the best editor for TS, but you wouldn't know it from trying to start a new project.

  1. Create a new .ts file in an empty folder:
console.log('hello')
  1. F5 to run.
    image
  2. Accept the provided launch.json, then try again.
  3. Same error. Maybe I need to compile it? (however a newcomer might not know that)
  4. Search command pallette for "TypeScript" in hopes of finding a way to compile the current file or initialize a new project.
    image
    Secretly, "Go to Project Configuration" is what I want, but again a newcomer wouldn't know that
    image
    We should have a "Typescript: Configure tsconfig.json" or "Typescript: Initialize Project" or similar to go straight to making the tsconfig.
  5. Accept the provided tsconfig.json (also note the default file is reported as having an error):
    image
  6. Try running the file again. Same error!
  7. Add "sourceMap": true to the tsconfig.json. The file now runs.

At the very least we should make the default tsconfig.json output source maps, as VS Code is crippled without them. It should also not come with the error about checkJs by default, either by removing it or adding allowJs.

We should also make the error message give some hints about how to fix the problem (Do you have source maps enabled for this project? Have you built the project? Are the files in the location specified in the launch.json, etc.), as suggesting a launch.json identical to the existing one is never the right solution.

Going beyond that, it would be nice to have a thought out flow for going from a .ts file to a proper VS Code experience.

@vscodebot vscodebot bot assigned mjbvz Jan 2, 2020
@vscodebot vscodebot bot added the typescript Typescript support issues label Jan 2, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Jan 6, 2020

I'll add "sourceMap": true to the default tsconfig we generate

We have discussed bundling tsc with VS Code in the past. However this would add ~6mb to our bundle size and we also weren't sure we wanted people relying for VS code for their compiles (for example, when we ship a VS Code update, we want to avoid breaking compilation of someone's project)

/cc @DanielRosenwasser and @gcrev93 for other thoughts on the TS first run experience

mjbvz added a commit that referenced this issue Jan 6, 2020
@mjbvz mjbvz added the under-discussion Issue is under discussion for relevance, priority, approach label Jan 6, 2020
@mjbvz mjbvz added this to the Backlog milestone Jan 6, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Oct 3, 2020

@mjbvz
Copy link
Collaborator

mjbvz commented Oct 3, 2020

@connor4312 Any ideas about making it simpler to debug TS files for beginners? If the user has tsc installed globally or under node_modules, could we automatically compile on f5?

@connor4312
Copy link
Member

connor4312 commented Oct 3, 2020

@mjbvz we actually include typescript internally already in js-debug that we use for a lot of syntax tree work. So we could do it without even requiring an npm install... basically do something like ts-node's transpileOnly mode.

I like that idea as a way to get beginners using TS without a whole bunch of setup. I don't want that scenario for the intermediate to advanced users that have a proper build setup; maybe we have a transpileTypeScript flag that's on for default F5 debugging but requires manual opt-in inside launch.json.

@mjbvz mjbvz changed the title Starting new TS projects is overly difficult Allow debugging TS code out of the box Mar 23, 2021
@mjbvz
Copy link
Collaborator

mjbvz commented Mar 23, 2021

Renaming this to focus on f5. Please split any other concerns to their own issues

@JacksonKearl JacksonKearl removed their assignment Apr 8, 2022
@mjbvz mjbvz added the feature-request Request for new features or functionality label Dec 5, 2022
@connor4312
Copy link
Member

Merging into #124280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality typescript Typescript support issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

3 participants