Skip to content

Renaming file triggers error in tsconfig.json #46432

Closed

Description

@zgoda

TS Template added by Matt Bierner (@mjbvz)

TypeScript Version: 4.5.0-dev.20211019

Search Terms

  • jsconfig / tsconfig
  • config
  • configFileDiag

See #46432 (comment) for the simplest repo


Issue Type: Bug

The project is in JS but has configured TS support with tsconfig.json. After renaming source file in explorer pane, following error appears twice in problems pane pointing to tsconfig.json:

File '/home/jarek/work/wymarsz/wk-web/node_modules/source-map/source-map' not found.
  The file is in the program because:
    Root file specified for compilation

The issue appears also with all extensions disabled.

The error goes away after window reload.

Reproductible: always.

VS Code version: Code 1.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:43:02.136Z)
OS version: Linux x64 5.4.0-81-generic
Restricted Mode: No

System Info
Item Value
CPUs AMD Ryzen 5 3400G with Radeon Vega Graphics (8 x 2002)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 1
Memory (System) 29.34GB (23.56GB free)
Process Argv --unity-launch --crash-reporter-id 75655822-4d79-453c-9a0d-23266699ca32
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Extensions (6)
Extension Author (truncated) Version
vscode-eslint dba 2.1.23
gitlens eam 11.6.0
EditorConfig Edi 0.16.4
prettier-vscode esb 8.1.0
dotenv mik 1.0.1
sass-indented syl 1.8.18

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805:30301674
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
vsccppwt:30329788
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30360495
bridge0723:30353136
pythonf5test824:30361777
vsdyn478:30356813
pythonvspyt187cf:30362783
pydsgst2:30361792
vscus224:30358039
vssid140:30362080

Zrzut ekranu z 2021-09-07 11-53-45

Activity

  1. zgoda commented on Sep 7, 2021

    @zgoda
    Author

    Moving file in explorer triggers the same issue.

    tsconfig.json content:

    {
      "compileOnSave": false,
      "compilerOptions": {
        "jsx": "preserve",
        "jsxFactory": "preact.h",
        "jsxFragmentFactory": "preact.Fragment",
        "allowJs": true,
        "checkJs": true,
        "noEmit": true,
        "moduleResolution": "node",
        "target": "ESNext",
        "module": "esnext",
        "resolveJsonModule": true,
        "allowSyntheticDefaultImports": true,
        "downlevelIteration": true
      },
      "include": ["node_modules/wmr/types.d.ts", "**/*"],
      "typeAcquisition": {
        "enable": true
      }
    }
    
  2. mjbvz commented on Sep 7, 2021

    @mjbvz
    Contributor

    Please share a minimal example project that demonstrates the issue

  3. zgoda commented on Sep 8, 2021

    @zgoda
    Author

    Not exactly minimal: https://github.com/zgoda/wk-web

    Really minimal is skeleton project created with npm init wmr@latest myproject.

  4. mjbvz commented on Sep 8, 2021

    @mjbvz
    Contributor

    Please share steps to reproduce that using the project

  5. zgoda commented on Sep 8, 2021

    @zgoda
    Author
    1. Open project directory in VSC.
    2. Right click in explorer on one of JS files, select Rename.
    3. Change name of file, hit enter; error in tsconfig.json appears.
    4. Reload window; error in tsconfig.json goes away.

    Subsequent rename operations do not trigger this behaviour.

  6. zgoda commented on Sep 20, 2021

    @zgoda
    Author

    The same happens on OS X:

    Version: 1.60.1
    Commit: 83bd43bc519d15e50c4272c6cf5c1479df196a4d
    Date: 2021-09-10T17:09:14.403Z
    Electron: 13.1.8
    Chrome: 91.0.4472.164
    Node.js: 14.16.0
    V8: 9.1.269.39-electron.0
    OS: Darwin x64 20.6.0
    

    Also, editing tsconfig.json also triggers this behaviour.

  7. zgoda commented on Sep 20, 2021

    @zgoda
    Author

    I see people asking for that on Reddit and SO and the only answer is "reload window to fix temporarily".

    The package (and file) definitely exists:

    $ ls -al /home/jazg/work/wymarsz/wk-web/node_modules/source-map/source-map.js 
    -rw-rw-r-- 1 jazg jazg 405 sie 30 00:45 /home/jazg/work/wymarsz/wk-web/node_modules/source-map/source-map.js
    
  8. zgoda commented on Oct 11, 2021

    @zgoda
    Author

    File jsconfig.json in another project triggers the same kind of error

    Screenshot 2021-10-11 at 17 14 10

  9. Tarrowren commented on Oct 12, 2021

    @Tarrowren

    Please share steps to reproduce that using the project

    install adler-32

    npm i adler-32

    create jsconfig.json

    {
      "compilerOptions": {},
      "include": ["src"],
      "exclude": ["node_modules"]
    }

    If no error is reported, edit jsconfig.json multiple times
    image

  10. mjbvz commented on Oct 19, 2021

    @mjbvz
    Contributor

    Thanks! Confirmed this in the latest typescript build

    Using the steps in #46432 (comment), I also confirmed the types directory does exist on disk

  11. removed their assignment
    on Oct 19, 2021
  12. Tarrowren commented on Oct 20, 2021

    @Tarrowren

    My solution #42840 (comment)
    and I think these two are the same problem

  13. 13 remaining items

  14. Luxcium commented on Dec 1, 2022

    @Luxcium

    As I mentioned in #43838 :

    For the moment I have changed my keybindings (using VS Code) and I think I will be using them often so I will probably change them again...

    Screenshot_000001_20221201_092230

    It remaps some default keybindings, You probably need something similar depending on your workflow...

  15. DanielRosenwasser commented on Dec 16, 2022

    @DanielRosenwasser
    Member

    It sounds a whole lot like TypeScript 4.8's file-watching fixes and TypeScript 4.9's usage of file system events should alleviate this issue. The 4.8 fix targeted Unix-like systems (including Linux and macOS) if that's relevant to anyone reading this.

    So I'm curious to hear if anyone is experiencing this with the latest version of TS.

  16. jleclanche commented on Dec 17, 2022

    @jleclanche

    Daniel Rosenwasser (@DanielRosenwasser) yes, I've been able to reproduce this in WSL and TS 4.9. I don't remember if I experienced it on Linux itself.

  17. Ashin-55 commented on Jan 24, 2023

    @Ashin-55

    i got the same error while renaming any file ,
    Screenshot from 2023-01-24 20-16-42
    then I reopened the code again, and that time the error is not showing...

    typescript 4.3.5

  18. sandersn commented on Feb 6, 2023

    @sandersn
    Member

    The repro I get now is exactly #43838, so I think the original bug has been fixed -- the bizarro "thing in node_modules is not found" been replaced by the similar, slightly better, but obviously-wrong "The old name of the thing you renamed is not found."

  19. jonschlinkert commented on Jul 2, 2024

    @jonschlinkert

    I still have this error, literally every time I rename any file.

  20. gameprogrammingsteven commented on Jul 4, 2024

    @gameprogrammingsteven

    I just got this error as well. It seems to repro when I rename things above my src dir for React. It does not fix when I re-rename it file -> file_old -> file again (.tsx extension)

  21. ChristopherHaws commented on Jul 23, 2024

    @ChristopherHaws

    This issue should not be closed. I have been dealing with this issue for over a year now, it's an awful developer experience. Is it really that hard to watch the file system? I feel like every other language is able to do this... For the longest time I thought it was just a local environment, but even on fresh installs of Windows or Linux I instantly run into this issue. I have tried different configurations of typescript.tsserver.watchOptions, files.watcherInclude, and files.watcherExclude in VSCode to no avail.

    NOTE: I am using pnpm and not npm

  22. sheetalkamat commented on Jul 23, 2024

    @sheetalkamat
    Member

    If this is still an issue, you should file a new issue with clear steps to repro, tsserver log so that can be investigated.

  23. gameprogrammingsteven commented on Aug 18, 2024

    @gameprogrammingsteven

    If you need clearer instructions than "rename file", maybe you're not meant for this job.

  24. locked as resolved and limited conversation to collaborators on Aug 19, 2024
  25. RyanCavanaugh commented on Aug 19, 2024

    @RyanCavanaugh
    Member

    Stephen J (@gameprogrammingsteven) please refer to the code of conduct and consider yourself warned re "insults"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions