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

LSP client sends wrong 'workspace/didChangeWatchedFiles' events when Moving / Renaming files #6309

Open
dschafhauser opened this issue Oct 2, 2019 · 2 comments
Labels
bug bugs found in the application filesystem issues related to the filesystem help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility

Comments

@dschafhauser
Copy link
Contributor

Description

The Theia LSP client sends erroneous 'workspace/didChangeWatchedFiles' events when moving or renaming a file.
Moreover, the observed behavior differs depending on the OS hosting the Theia backend.

This is an issue, because a LSP server might rely on this watching behavior to keep track of files inside the workspace.
In fact, some language servers (e.g. the Java LSP) throw exceptions because of URIs becoming invalid.

Reproduction Steps

  1. Open https://gitpod.io#https://github.com/dschafhauser/theia-filesystem-issue or run the example code in a local Theia instance.
  2. Set Json LSP log level to verbose:
{
   "json.trace.server": "verbose"
}
  1. Open the Json LSP channel on the Output view
  2. Move a .json file from the root folder to "folder" or vice versa.
  3. Observe the "workspace/didChangeWatchedFiles" event.

OS and Theia version:
Windows host: Windows 10 - 1809 (OS Build 17763.740)
Linus host: Linux alpine:3.10.2
Theia Version: 0.10.0

Diagnostics

Scenario 1: Move "Json.json" into the directory "folder"
Running on a Windows machine:

Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///d:/workspace/theia-filesystem-issue/Json.json",
            "type": 3
        },
        {
            "uri": "file:///d:/workspace/theia-filesystem-issue/folder/Json.json",
            "type": 1
        }
    ]
}

=> Correct

Running on a Linux machine / gitpod.io:

Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///workspace/theia-filesystem-issue/Json.json",
            "type": 2
        }
    ]
}

=> Wrong

Scenario 2: Rename "Json.json" to "JsonRenamed.json"
Running locally on a Windows machine:

Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///d:/workspace/theia-filesystem-issue/Json.json",
            "type": 2
        },
        {
            "uri": "file:///d:/workspace/theia-filesystem-issue/JsonRenamed.json",
            "type": 1
        }
    ]
}

=> Wrong

Running on a Linux machine / gitpod.io:

Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///workspace/theia-filesystem-issue/Json.json",
            "type": 3
        },
        {
            "uri": "file:///workspace/theia-filesystem-issue/JsonRenamed.json",
            "type": 1
        }
    ]
}

=> Correct

@akosyakov akosyakov added bug bugs found in the application filesystem issues related to the filesystem help wanted issues meant to be picked up, require help lsp language server protocol labels Oct 2, 2019
@akosyakov
Copy link
Member

@dschafhauser thank you for the issue, could you try please whether it is still reproducible with the master. Yesterday a fix was merged related to handling fo fs rename events.

@tsmaeder tsmaeder added vscode issues related to VSCode compatibility and removed lsp language server protocol labels May 7, 2021
@tsmaeder
Copy link
Contributor

tsmaeder commented May 7, 2021

We no longer use LSP, but if we generate the wrong events, we might have the same issue with the vscode API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application filesystem issues related to the filesystem help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility
Projects
None yet
Development

No branches or pull requests

3 participants