-
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.
Merge pull request #7633 from dotnet/merge/main-to-prerelease
[automated] Merge branch 'main' => 'prerelease'
- Loading branch information
Showing
12 changed files
with
140 additions
and
9 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
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
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,31 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* 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 * as RoslynProtocol from './roslynProtocol'; | ||
import { RoslynLanguageServer } from './roslynLanguageServer'; | ||
import { UriConverter } from './uriConverter'; | ||
import * as lsp from 'vscode-languageserver-protocol'; | ||
|
||
export function registerSourceGeneratedFilesContentProvider( | ||
context: vscode.ExtensionContext, | ||
languageServer: RoslynLanguageServer | ||
) { | ||
context.subscriptions.push( | ||
vscode.workspace.registerTextDocumentContentProvider( | ||
'roslyn-source-generated', | ||
new (class implements vscode.TextDocumentContentProvider { | ||
async provideTextDocumentContent(uri: vscode.Uri, token: vscode.CancellationToken): Promise<string> { | ||
const result = await languageServer.sendRequest( | ||
RoslynProtocol.SourceGeneratorGetTextRequest.type, | ||
{ textDocument: lsp.TextDocumentIdentifier.create(UriConverter.serialize(uri)) }, | ||
token | ||
); | ||
return result.text; | ||
} | ||
})() | ||
) | ||
); | ||
} |
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,43 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { | ||
CancellationToken, | ||
LanguageClient, | ||
LanguageClientOptions, | ||
MessageSignature, | ||
ServerOptions, | ||
} from 'vscode-languageclient/node'; | ||
import { RazorLanguageServerOptions } from './razorLanguageServerOptions'; | ||
|
||
export class RazorLanguageClient extends LanguageClient { | ||
razorOptions: RazorLanguageServerOptions; | ||
|
||
constructor( | ||
id: string, | ||
name: string, | ||
serverOptions: ServerOptions, | ||
clientOptions: LanguageClientOptions, | ||
razorOptions: RazorLanguageServerOptions, | ||
forceDebug?: boolean | ||
) { | ||
super(id, name, serverOptions, clientOptions, forceDebug); | ||
this.razorOptions = razorOptions; | ||
} | ||
|
||
override handleFailedRequest<T>( | ||
type: MessageSignature, | ||
token: CancellationToken | undefined, | ||
error: any, | ||
defaultValue: T, | ||
showNotification?: boolean | ||
) { | ||
if (this.razorOptions.suppressErrorToasts) { | ||
return super.handleFailedRequest(type, token, error, defaultValue, false); | ||
} | ||
|
||
return super.handleFailedRequest(type, token, error, defaultValue, showNotification); | ||
} | ||
} |
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