angular / vscode-ng-language-service

Angular extension for Visual Studio Code
MIT License
770 stars 116 forks source link

Fails to rename folder with angular files in sub-folders #1398

Open snebjorn opened 3 years ago

snebjorn commented 3 years ago

🐞 bug report

Is this a regression?

I believe it is. I discovered this bug after ESLint in Angular officially became a thing. I don't know if it's related to ESLint or the language service was updated around that time.

Description

VSCode throws the following error when I try to rename a folder that have sub-folders with Angular files in them.

Error: EPERM: operation not permitted, rename 'path\to\ng-project\src' -> 'path\to\ng-project\renamed-src'

Disclaimer: Unless otherwise described I have disabled ALL VSCode extensions except for Angular Language Service.

Here I'm renaming the src folder of a newly generated Angular project. Observe that it fails to rename the folder. Renaming folder with sub-folders

Here I'm renaming the app folder of a newly generated Angular project. Observe that it successfully renamed the folder. Renaming leaf folder

Here I'm renaming the src folder of a newly generated Angular project, but I have disabled the Angular Language Service. Observe that it successfully renamed the folder. 2021-06-03-11-18-50

Bug Type

What does this bug affect

Reproduction

Steps to reproduce the behavior:

  1. Generate a new project using the Angular CLI ng new
  2. Configure ESLint ng add @angular-eslint/schematics - I'm not sure this is necessary
  3. Open the project in VSCode (with Angular Language Service installed)
  4. Open one of the files so the Angular Language Service activates
  5. Rename the src folder
  6. See error

Expected behavior

The src folder should be successfully renamed.

Logs

https://gist.github.com/snebjorn/3c38ebd5e47af01c8bcf7c78bc297e62

🌍 Your Environment

Angular Version:


Angular CLI: 12.0.2
Node: 14.15.1
Package Manager: npm 7.15.1
OS: win32 x64

Angular: 12.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.2
@angular-devkit/build-angular   12.0.2
@angular-devkit/core            12.0.2
@angular-devkit/schematics      12.0.2
@schematics/angular             12.0.2
rxjs                            6.6.7
typescript                      4.2.4

Extension Version:


v12.0.3

VSCode Version:


v1.56.2 (system setup)

Operating System:


Windows 10 Version 2004 OS Build 19041.985
jaytonic commented 3 years ago

Any known workaround?

daverickdunn commented 3 years ago

@jaytonic While the renaming task is "stuck", bring up your command palette with ctrl + shift + p and start typing restart, you're looking for Angular: Restart Angular Language server (it's the first hit for me). Press Enter. The "stuck" renaming should complete immediately.

As a bonus: If you bring up the command palette again, you can click the little cog to the right of Angular: Restart Angular Language server and bind it to a key.

MonarchiaLIMMAVMFEAR commented 3 years ago

800

dsbert commented 2 years ago

This same issue applies to moving folders (but not files) within a workspace. The language service holds a lock on the folder.

mrtabaa commented 1 year ago
  1. If files/folders are moved or renamed, put them to their previous states.
  2. Make sure Angular Language Service is updated to v15+.
  3. Disable and Reenable the extension.
  4. Restart "ng serve" or "ng build".
xigolle commented 10 months ago

Is there any progress on solving this issue. Seems like a really big issue to not simple rename folders without having to restart the service everytime.

baratgabor commented 9 months ago

I don't know how come this issue doesn't get more attention from the community. I've been experiencing it on a daily basis, and it's an absolute cancer having to struggle with such a basic operation as renaming something.

Andriana93 commented 4 months ago

I have had this issue for the last 9 months at work. I kept thinking it was a file permissions issue and was struggling to find the reason why, not even IT could help me. I disabled the language service extension and it finally worked! Please angular team if you can fix this bug!