Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
## Project Conventions & Patterns
- **TypeScript**: Follows strict linting (`.eslintrc.js`), including header/license blocks and camelCase filenames (except for interfaces and special files).
- **Code Formatting**: After making code edits, always run `npx eslint <file-path> --fix` to auto-fix formatting issues (prettier) and lint errors. This ensures code passes CI checks.
- **Language Client Imports**: Import shared protocol and middleware types from `vscode-languageclient`, but import the concrete `LanguageClient`, process-launch `ServerOptions`, and transport types from `vscode-languageclient/node`. Do not add new direct imports or type references from `vscode-jsonrpc` or `vscode-languageserver-protocol` in code that flows through the language client; prefer the `vscode-languageclient` re-exports instead. Avoid defining request and notification types from bare `vscode-jsonrpc`, since mixed package instances can cause parameter-structure type and runtime mismatches.
- **Component Downloads**: Language servers and debuggers are downloaded at runtime; see `package.json` for URLs and install logic.
- **Copilot Providers**: Use `registerCopilotContextProviders` and `registerCopilotRelatedFilesProvider` to extend Copilot context for C#.
- **Testing**: Prefer integration tests over unit tests for features. Structure follows:
Expand Down
1 change: 0 additions & 1 deletion l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@
"Recording trace... Click Cancel to stop and save.": "Recording trace... Click Cancel to stop and save.",
"Recording logs... Click Cancel to stop and save.": "Recording logs... Click Cancel to stop and save.",
"Collecting C# Logs": "Collecting C# Logs",
"Generated document not found": "Generated document not found",
"Nested Code Action": "Nested Code Action",
"Fix All: ": "Fix All: ",
"Pick a fix all scope": "Pick a fix all scope",
Expand Down
66 changes: 31 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@
"rxjs": "6.6.7",
"semver": "7.5.4",
"vscode-html-languageservice": "^5.3.1",
"vscode-jsonrpc": "9.0.0-next.10",
"vscode-languageclient": "10.0.0-next.18",
"vscode-languageserver-protocol": "3.17.6-next.15",
"vscode-languageserver-textdocument": "1.0.12",
"vscode-languageserver-types": "3.17.6-next.6",
"vscode-languageclient": "10.0.0-next.20",
"yauzl": "3.2.1"
},
"devDependencies": {
Expand Down
5 changes: 2 additions & 3 deletions src/coreclrDebug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import { RemoteAttachPicker } from '../shared/processPicker';
import CompositeDisposable from '../compositeDisposable';
import { BaseVsDbgConfigurationProvider } from '../shared/configurationProvider';
import { omnisharpOptions } from '../shared/options';
import { ActionOption, showErrorMessage } from '../shared/observers/utils/showMessage';
import { ActionOption, CommandOption, showErrorMessage } from '../shared/observers/utils/showMessage';
import { getCSharpDevKit } from '../utils/getCSharpDevKit';
import { Command } from 'vscode-languageserver-types';

export async function activate(
thisExtension: vscode.Extension<any>,
Expand Down Expand Up @@ -224,7 +223,7 @@ function showInstallErrorMessage(eventStream: EventStream) {
function showDotnetToolsWarning(message: string): void {
const config = vscode.workspace.getConfiguration('csharp');
if (!config.get('suppressDotnetInstallWarning', false)) {
const getDotNetMessage: ActionOption | Command =
const getDotNetMessage: ActionOption | CommandOption =
getCSharpDevKit() !== undefined
? {
title: vscode.l10n.t('Get the SDK'),
Expand Down
6 changes: 3 additions & 3 deletions src/csharpExtensionExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { Advisor } from './omnisharp/features/diagnosticsProvider';
import { EventStream } from './eventStream';
import TestManager from './omnisharp/features/dotnetTest';
import { GlobalBrokeredServiceContainer } from '@microsoft/servicehub-framework';
import { PartialResultParams, ProtocolRequestType, RequestType } from 'vscode-languageclient/node';
import { LanguageServerEvents } from './lsptoolshost/server/languageServerEvents';
import { PartialResultParams, ProtocolRequestType, RequestParam, RequestType } from 'vscode-languageclient';

export interface LimitedExtensionExports {
isLimitedActivation: true;
Expand Down Expand Up @@ -49,7 +49,7 @@ export interface CSharpExtensionExports {
export interface CSharpExtensionExperimentalExports {
sendServerRequest: <Params, Response, Error>(
type: RequestType<Params, Response, Error>,
params: Params,
params: RequestParam<Params>,
token: vscode.CancellationToken
) => Promise<Response>;
sendServerRequestWithProgress<
Expand All @@ -60,7 +60,7 @@ export interface CSharpExtensionExperimentalExports {
RegistrationOptions
>(
type: ProtocolRequestType<Params, Response, PartialResult, Error, RegistrationOptions>,
params: Params,
params: RequestParam<Params>,
onProgress: (p: PartialResult) => Promise<any>,
token?: vscode.CancellationToken
): Promise<Response>;
Expand Down
2 changes: 0 additions & 2 deletions src/lsptoolshost/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { registerCodeActionFixAllCommands } from './diagnostics/fixAllCodeAction
import { commonOptions, languageServerOptions } from '../shared/options';
import { registerNestedCodeActionCommands } from './diagnostics/nestedCodeAction';
import { registerRestoreCommands } from './projectRestore/restore';
import { registerSourceGeneratedFilesContentProvider } from './generators/sourceGeneratedFilesContentProvider';
import { registerMiscellaneousFileNotifier } from './workspace/miscellaneousFileNotifier';
import { TelemetryEventNames } from '../shared/telemetryEventNames';
import { WorkspaceStatus } from './workspace/workspaceStatus';
Expand Down Expand Up @@ -96,7 +95,6 @@ export async function activateRoslynLanguageServer(

registerRestoreCommands(context, languageServer, _channel);

registerSourceGeneratedFilesContentProvider(context, languageServer);
registerSourceGeneratorRefresh(context, languageServer, _channel);

context.subscriptions.push(registerLanguageServerOptionChanges(optionObservable));
Expand Down
10 changes: 3 additions & 7 deletions src/lsptoolshost/autoInsert/onAutoInsert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import {
FormattingOptions,
InsertTextFormat,
LanguageClient,
TextDocumentIdentifier,
} from 'vscode-languageclient/node';
import * as RoslynProtocol from '../server/roslynProtocol';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { FormattingOptions, InsertTextFormat, Range, TextDocumentIdentifier } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/node';

export function registerOnAutoInsert(languageServer: RoslynLanguageServer, languageClient: LanguageClient) {
let source = new vscode.CancellationTokenSource();
Expand All @@ -33,7 +29,7 @@ export function registerOnAutoInsert(languageServer: RoslynLanguageServer, langu
}

// Convert to a VSCode range for ease of handling.
const vscodeRange = languageClient.protocol2CodeConverter.asRange(change.range);
const vscodeRange = languageClient.protocol2CodeConverter.asRange(change.range as Range);

// Empty or multiline changes are not supported for onautoinsert.
if (!vscodeRange.isEmpty || !vscodeRange.isSingleLine) {
Expand Down
5 changes: 3 additions & 2 deletions src/lsptoolshost/autoInsert/onAutoInsertFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TextDocument,
} from 'vscode';

import { DynamicFeature, FeatureState, LanguageClient, RegistrationData, ensure } from 'vscode-languageclient/node';
import { DynamicFeature, FeatureState, RegistrationData, ensure } from 'vscode-languageclient';

import {
ClientCapabilities,
Expand All @@ -19,10 +19,11 @@ import {
ProtocolRequestType,
RegistrationType,
ServerCapabilities,
} from 'vscode-languageserver-protocol';
} from 'vscode-languageclient';

import * as RoslynProtocol from '../server/roslynProtocol';
import { randomUUID } from 'crypto';
import { LanguageClient } from 'vscode-languageclient/node';

export class OnAutoInsertFeature implements DynamicFeature<RoslynProtocol.OnAutoInsertRegistrationOptions> {
private readonly _client: LanguageClient;
Expand Down
2 changes: 1 addition & 1 deletion src/lsptoolshost/copilot/contextProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type ContextProvider,
} from '@github/copilot-language-server';
import * as vscode from 'vscode';
import * as lsp from 'vscode-languageserver-protocol';
import * as lsp from 'vscode-languageclient';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { CSharpExtensionId } from '../../constants/csharpExtensionId';
import { getCSharpDevKit } from '../../utils/getCSharpDevKit';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken } from 'vscode-languageclient';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { CancellationToken } from 'vscode-jsonrpc';
import * as vscode from 'vscode';

interface IBuildResultDiagnostics {
Expand Down
2 changes: 1 addition & 1 deletion src/lsptoolshost/diagnostics/diagnosticMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import { ProvideDiagnosticSignature, ProvideWorkspaceDiagnosticSignature, vsdiag } from 'vscode-languageclient/node';
import { ProvideDiagnosticSignature, ProvideWorkspaceDiagnosticSignature, vsdiag } from 'vscode-languageclient';
import { languageServerOptions } from '../../shared/options';

export async function provideDiagnostics(
Expand Down
2 changes: 1 addition & 1 deletion src/lsptoolshost/diagnostics/fixAllCodeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as vscode from 'vscode';
import * as RoslynProtocol from '../server/roslynProtocol';
import { LSPAny } from 'vscode-languageserver-protocol';
import { LSPAny } from 'vscode-languageclient';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { URIConverter, createConverter } from 'vscode-languageclient/protocolConverter';
import { UriConverter } from '../utils/uriConverter';
Expand Down
2 changes: 1 addition & 1 deletion src/lsptoolshost/diagnostics/nestedCodeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import { CodeAction, CodeActionResolveRequest, LSPAny } from 'vscode-languageserver-protocol';
import { CodeAction, CodeActionResolveRequest, LSPAny } from 'vscode-languageclient';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { URIConverter, createConverter } from 'vscode-languageclient/protocolConverter';
import { UriConverter } from '../utils/uriConverter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { RequestType } from 'vscode-jsonrpc';
import { RoslynLanguageServer } from '../server/roslynLanguageServer';
import { PartialResultParams, ProtocolRequestType } from 'vscode-languageserver-protocol';
import { PartialResultParams, ProtocolRequestType, RequestParam, RequestType } from 'vscode-languageclient';

export class RoslynLanguageServerExport {
constructor(private _serverInitialized: Promise<RoslynLanguageServer>) {}

public async sendRequest<Params, Response, Error>(
type: RequestType<Params, Response, Error>,
params: Params,
params: RequestParam<Params>,
token: vscode.CancellationToken
): Promise<Response> {
const server = await this._serverInitialized;
// 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);
const newType = new RequestType<Params, Response, Error>(type.method, type.parameterStructures);
return await server.sendRequest(newType, params, token);
}

Expand All @@ -30,7 +29,7 @@ export class RoslynLanguageServerExport {
RegistrationOptions
>(
type: ProtocolRequestType<Params, Response, PartialResult, Error, RegistrationOptions>,
params: Params,
params: RequestParam<Params>,
onProgress: (p: PartialResult) => Promise<any>,
token?: vscode.CancellationToken
): Promise<Response> {
Expand Down
Loading
Loading