Skip to content

finally is not a function error hit with _getServerWorkingDir #1653

@rcjsuen

Description

@rcjsuen
TypeError this._getServerWorkingDir(...).then(...).finally is not a function 
    extension.js:1:395787 d.createMessageTransports
    extension.js:1:226888 d.createConnection
    extension.js:1:217342 d.start
    extension.js:1:130234 _

private _getServerWorkingDir(options?: { cwd?: string }): Promise<string | undefined> {
let cwd = options && options.cwd;
if (!cwd) {
cwd = this.clientOptions.workspaceFolder
? this.clientOptions.workspaceFolder.uri.fsPath
: this._mainGetRootPath();
}
if (cwd) {
// make sure the folder exists otherwise creating the process will fail
return new Promise(s => {
fs.lstat(cwd!, (err, stats) => {
s(!err && stats.isDirectory() ? cwd : undefined);
});
});
}
return Promise.resolve(undefined);
}

I see this error in the telemetry of our VS Code extension. If I try to search the error on the Internet, I can find a single StackOverflow post talking about the same thing. I have looked at the code and tried writing a small JavaScript program but can't quite figure out in what case this might happen. We are on 9.0.1 of vscode-languageclient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions