TypeStrong / atom-typescript

The only TypeScript package you will ever need
https://atom.io/packages/atom-typescript
MIT License
1.13k stars 205 forks source link

A lot of Pending Requests #969

Closed AndersonDev closed 4 years ago

AndersonDev commented 8 years ago

Hi. I am using Angular 2 and Webpack for developing an Atom with atom-typescript. On every save I have increasing of pending requests. I tried to find solution, however they are old...

image

Thanks!

DNRN commented 8 years ago

I have a similar issue. Please help us on this one, because working in Atom right now is a bit frustrating :)

nikhildev commented 8 years ago

Do you mind posting your tsconfig file?

pstawinski commented 8 years ago

I have same problem. My project is build on: https://github.com/preboot/angular2-webpack with almost no changes... So my tsconfig is:

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "noEmitHelpers": true
  },
  "compileOnSave": false,
  "buildOnSave": false
}
nikhildev commented 8 years ago

I had the same issue. Basically, the plugin wasn't able to find my ts files and thats why the pending requests were getting queued up. I got around it by including

"filesGlob": [
      "**/*.ts"
    ],

and

"atom": {
    "rewriteTsconfig": true
  }

In my tsconfig. This will rewrite the tsconfig file by scanning through your application for .ts files. Also, make sure that the tsconfig is the root folder of your app src and does not have node_modules as any child.

AndersonDev commented 8 years ago

@DNRN @nikhildev @pstawinski the solusion is very easy:

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "buildOnSave": false
}

We add:

"exclude": [
    "node_modules"
  ]

and compiler ignore the tone of aditional files.

pstawinski commented 8 years ago

Thank you!

robyoder commented 8 years ago

Excluding node_modules seemed to help briefly, but after a few seconds, I'm back with the same kind of errors:

screen shot 2016-07-18 at 6 45 19 pm
robyoder commented 8 years ago

Related issues: #968, #1037. There are several old related issues as well (#728, #760, #556, #349), but they seem to have been resolved at one point and now the problem is back. @basarat, any ideas?

Here are my latest errors:

screen shot 2016-08-05 at 1 40 34 pm
robyoder commented 8 years ago

So, another data point. I originally had tsconfig referencing files like this:

    "files": [
        "src/ts/main.ts",
        "typings/index.d.ts"
    ]

My main.ts file is the entry point and all the other files are referenced via imports. I thought that would be the best way, and I would avoid spending time compiling files that I wasn't currently referencing anywhere. If I change that to this, though, it seems to work fine:

    "filesGlob": [
        "src/ts/**/*.ts",
        "typings/index.d.ts"
    ]

This apparently lets TS build its index much faster and seems to be the recommended way. My question is, though, is my first way supposed to be supported?

intellix commented 8 years ago

I also can't understand how there's such a large difference in performance between atom-typescript and VSCode. I wonder what VSCode is doing differently to make it work flawlessly with an angular-cli generated project.

I have a component like this:

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  constructor(private router: Router) { }

  ngOnInit() {
  }

  onLogin(user) {
    // this.router.navigate(['village']);
  }
}

If I open up the project in VSCode and go to add another import from @angular/router, I'm instantly given a list of available imports. If I go to the onLogin method and go to type this.router, I'm instantly given a list of the available methods I'm allowed to call (navigate etc).

If I try the same with atom-typescript, my autocompletes can take between 3seconds, 1 minute or sometimes they don't appear at all if I have errors in my code.

I'm using TS 2.0.2 and my tsconfig.json inside the root of the project:

{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "dom"],
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ]
  }
}

I wouldn't say it's anything to do with Webpack or Broccoli as both of those build-systems are not running at the moment. Is there perhaps one large-issue created about this or any other bits of information?

aderbas commented 7 years ago

Any solution for this? I am having the same problem in a Anguar 2 project, for me Infinity Pending Requests freezes a lot number.

tsconfig.json

{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "dom"],
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ]
  },
  "exclude": [
    "node_modules"
  ]
}
github-actions[bot] commented 4 years ago

This issue has been marked as stale because it did not have any activity for the last 90 days or more. Remove the stale label or comment or this will be closed in 14 days