Skip to content

New/renamed files not part of TS project #50329

Closed

Description

Every time I rename a file or create a new one, I have to restart TS server because my tsconfig.json doesn't apply on that file.
VScode (or typescript, i'm not sure) does not consider the file as part of project

Vscode Version 1.23.0
MacOS 10.13.4
Typescript 2.8.3

Steps to reproduce

  1. Open TS project with tsconfig.json in project root (TS module resolution and custom config working on all files)
  2. create new file/rename existing file
  3. exec "Typescript: Go to project configuration" and you I see the error below

screen shot 2018-05-23 at 1 28 26 pm

If I click "configure tsconfig.json" it opens up my tsconfig.json just fine


I checked TS server log, and this is part relates

Info 1388 [13:25:35.879] -----------------------------------------------
Info 1388 [13:25:35.879] Open files: 
Info 1388 [13:25:35.879] 	FileName: /Volumes/projects/myproject/app/index.ts ProjectRootPath: /Volumes/projects/myproject
Info 1388 [13:25:35.879] 		Projects: /Volumes/projects/myproject/tsconfig.json
Info 1388 [13:25:35.879] 	FileName: /Volumes/projects/myproject/app/renamed.tsx ProjectRootPath: /Volumes/projects/myproject
Info 1388 [13:25:35.879] 		Projects: /dev/null/inferredProject3*

My tsconfig:

{
    "compilerOptions": {
        "target": "esnext",
        "module": "esnext",
        "lib": [
            "es2017",
            "dom"
        ],
        "moduleResolution": "node",
        "jsx": "preserve",
        "baseUrl": "./app",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "sourceMap": true,
        "noUnusedLocals": true,
        "allowSyntheticDefaultImports": true,
        "noErrorTruncation": true,
        "paths": {
            "*": ["*", "app/*"]
        }
    },
    "typeAcquisition": {
        "enable": true
    },
}

Tried with extensions disabled. Issue persists

Reloading window or restarting ts server fixes this issue. I'm hoping someone has an idea how to fix this or what causes this? I've seen some other issues about this issue but they seem to have been fix and some fixes mentioned in comments don't apply to me (e.g. I do not have a "files" key in mytsconfig)

Activity

  1. added
    typescript
    on May 23, 2018
  2. tushar-singh commented on May 23, 2018

    @tushar-singh
    Author

    P.S. I tried reducing my config to just this, still getting the issue

    {
        "compilerOptions": {
            "target": "esnext",
            "module": "esnext",
            "moduleResolution": "node",
            "baseUrl": ".",
            "paths": {
                "*": ["app/*"]
            }
        },
    }
    
  3. tushar-singh commented on May 23, 2018

    @tushar-singh
    Author

    Telling VSCode to use workspace TS instead of inbuilt apparently fixes this.

    screen shot 2018-05-23 at 5 00 02 pm

  4. mjbvz commented on May 23, 2018

    @mjbvz
    Contributor

    Do you see this in vscode insiders using TypeScript 2.9?

  5. added
    info-needed
    on May 23, 2018
  6. tushar-singh commented on May 24, 2018

    @tushar-singh
    Author

    Working correctly in 2.9.1-insiders. So looks like this has been fixed
    Closing this. Thanks :)

  7. locked and limited conversation to collaborators on Jul 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededtypescript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions