-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new experimental API to the C# extension that allows other extensions to communicate with the C# language server. This API is not yet finalized and may change in the future. Relates to dotnet/roslyn#68696.
- Loading branch information
Showing
7 changed files
with
79 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import * as vscode from 'vscode'; | ||
import { RequestType } from 'vscode-languageclient/node'; | ||
import { RoslynLanguageServer } from './roslynLanguageServer'; | ||
|
||
export class RoslynLanguageServerExport { | ||
private _server: RoslynLanguageServer | undefined; | ||
|
||
constructor(private serverPromise: Promise<RoslynLanguageServer>) {} | ||
|
||
private async ensureServer(): Promise<RoslynLanguageServer> { | ||
if (this._server === undefined) { | ||
this._server = await this.serverPromise; | ||
} | ||
|
||
return this._server; | ||
} | ||
|
||
public async sendRequest<Params, Response, Error>( | ||
type: RequestType<Params, Response, Error>, | ||
params: Params, | ||
token: vscode.CancellationToken | ||
): Promise<Response> { | ||
const server = await this.ensureServer(); | ||
// We need to recreate the type parameter to ensure that the prototypes line up. The `RequestType` we receive could have been | ||
// from a different version. | ||
const newType = new RequestType<Params, Response, Error>(type.method); | ||
return await server.sendRequest(newType, params, token); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters