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

Cannot rename/move directories. #750

Closed
Goobles opened this issue Apr 26, 2020 · 10 comments · Fixed by #1129 or #1323
Closed

Cannot rename/move directories. #750

Goobles opened this issue Apr 26, 2020 · 10 comments · Fixed by #1129 or #1323
Labels

Comments

@Goobles
Copy link

Goobles commented Apr 26, 2020

Describe the bug

In windows, the ng language service plugin locks all folder/subfolders of the workspace.

I tracked this lock down with LockHunter.exe:
image
It points to the VSCode subprocess for angular.ng-template.0.901.3\server.

This lock causes renaming directories to fail with:
Error: EPERM: operation not permitted, rename '<source>' -> '<target>'

To Reproduce

Steps to reproduce the behavior:

  1. Open any angular workspace that has subdirectories
  2. Rename/move a directory within that workspace

Expected behavior

Folder renaming should work.

Logs

Not applicable.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Version info:

Angular CLI: 9.1.1
Node: 12.11.1     
OS: win32 x64     

Angular: 9.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Ivy Workspace: No

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cdk                      9.2.1
@angular/cli                      9.1.1
@angular/material                 9.2.1
@ngtools/webpack                  9.1.1
@schematics/angular               8.3.25
@schematics/update                0.901.1
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.42.0
@Goobles Goobles added the bug label Apr 26, 2020
@kyliau
Copy link
Contributor

kyliau commented Apr 30, 2020

This used to be a problem when we rolled our own tsserver, but we've stopped doing that, and now Angular LS relies completely on stock tsserver for file / project management. I wonder if we could reproduce the same problem using just tsserver.

@kyliau
Copy link
Contributor

kyliau commented Apr 30, 2020

One area we need to investigate is whether NON_POLLING_WATCHER is used. It is the default watcher, and is known to be more efficient and avoid problems like this.

@blogcraft
Copy link

This happens to me also. Is it related to when finally changing folder, the imports wont update?

@mvanderlee
Copy link

mvanderlee commented Oct 8, 2020

Still seeing this in 0.1001.0
Angular language server process holds a lot of locks forever, and I can not rename any directories.

[Info  - 4:52:05 PM] Using typescript/lib/tsserverlibrary v4.0.2 from c:\Users\maste\.vscode\extensions\angular.ng-template-0.1001.0\node_modules\typescript\lib\tsserverlibrary.js
[Info  - 4:52:05 PM] Using @angular/language-service v10.1.1 from c:\Users\maste\.vscode\extensions\angular.ng-template-0.1001.0\server\node_modules\@angular\language-service\bundles\language-service.js

@nischi
Copy link

nischi commented Dec 23, 2020

Is there any workaround, its super annoying if the refactor is need to be done by hand.

@blogcraft
Copy link

still no solution... 😔

@andrius-pra
Copy link
Contributor

Angular language service use non-pooling directory watchers and it does not allow to rename directories. Currently, it's not possible to change this behavior by .vscode\settings.json or tsconfig.json

@kyliau
Copy link
Contributor

kyliau commented Feb 19, 2021

The non-polling watchers are used to improve performance, but now that there's built-in option to configure watch mode, we should remove the environment variable.

kyliau added a commit to kyliau/vscode-ng-language-service that referenced this issue Feb 19, 2021
`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

Fix angular#750
kyliau added a commit that referenced this issue Feb 19, 2021
`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

Fix #750
kyliau added a commit that referenced this issue Mar 1, 2021
`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

Fix #750
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 22, 2021
@atscott atscott reopened this Apr 30, 2021
@atscott
Copy link
Collaborator

atscott commented Apr 30, 2021

Re-opening since we have to revert commit 17708d4 to address #1310

atscott added a commit to atscott/vscode-ng-language-service that referenced this issue May 4, 2021
…atchOptions

`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

The watch options used are derived from the user defined options in
their `tsconfig` combined with the default options provided to the
project service via `setHostConfiguration`
([code reference](https://github.com/microsoft/TypeScript/blob/f7ef1540d3c10fb282d1d433d9f2850b28391169/src/server/editorServices.ts#L2985-L2989)).

As noted in the documentation for configuration watch options, the
default when no watch options are provided falls back to `fs.watchFile`
with `250ms` for any file. This would cause the performance issues as
seen in angular#1310.

Fixes angular#750
atscott added a commit that referenced this issue May 4, 2021
…atchOptions (#1323)

`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

The watch options used are derived from the user defined options in
their `tsconfig` combined with the default options provided to the
project service via `setHostConfiguration`
([code reference](https://github.com/microsoft/TypeScript/blob/f7ef1540d3c10fb282d1d433d9f2850b28391169/src/server/editorServices.ts#L2985-L2989)).

As noted in the documentation for configuration watch options, the
default when no watch options are provided falls back to `fs.watchFile`
with `250ms` for any file. This would cause the performance issues as
seen in #1310.

Fixes #750
atscott added a commit to atscott/vscode-ng-language-service that referenced this issue May 4, 2021
…atchOptions (angular#1323)

`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

The watch options used are derived from the user defined options in
their `tsconfig` combined with the default options provided to the
project service via `setHostConfiguration`
([code reference](https://github.com/microsoft/TypeScript/blob/f7ef1540d3c10fb282d1d433d9f2850b28391169/src/server/editorServices.ts#L2985-L2989)).

As noted in the documentation for configuration watch options, the
default when no watch options are provided falls back to `fs.watchFile`
with `250ms` for any file. This would cause the performance issues as
seen in angular#1310.

Fixes angular#750
atscott added a commit that referenced this issue May 4, 2021
…atchOptions (#1323) (#1326)

`TSC_NONPOLLING_WATCHER` was used back in the early days to improve
file watcher performance, but it prevents files / directories from
being moved / renamed.
Since TS now provides built-in option to configure file watcher, this
environment variable is no longer needed.

See https://www.typescriptlang.org/docs/handbook/configuring-watch.html

The watch options used are derived from the user defined options in
their `tsconfig` combined with the default options provided to the
project service via `setHostConfiguration`
([code reference](https://github.com/microsoft/TypeScript/blob/f7ef1540d3c10fb282d1d433d9f2850b28391169/src/server/editorServices.ts#L2985-L2989)).

As noted in the documentation for configuration watch options, the
default when no watch options are provided falls back to `fs.watchFile`
with `250ms` for any file. This would cause the performance issues as
seen in #1310.

Fixes #750
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
7 participants