castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

I encountered an issue where code completion becomes abnormal after Solargraph receives the workspace/didChangeWorkspaceFolders request. #668

Open bluesaiz opened 1 year ago

bluesaiz commented 1 year ago

Currently, I am facing an issue where if solargraph receive a workspace/didChangeWorkspaceFolders request with the same folder in both the "added" and "removed" fields, such as in the following message:

jsonCopy code{
    "jsonrpc": "2.0",
    "method": "workspace/didChangeWorkspaceFolders",
    "params": {
        "event": {
            "added": [
                {
                    "uri": "file:///home/name/solargraph_test",
                    "name": "workpath"
                }
            ],
            "removed": [
                {
                    "uri": "file:///home/name/solargraph_test",
                    "name": "workpath"
                }
            ]
        }
    }
}

I found the current code handling is problematic:

def process
    add_folders
    remove_folders  
end

image

maybe changed to:

def process
    remove_folders  
    add_folders
end

in order to handle more cases.