Skip to content

Commit

Permalink
Move openSolutionParams and openProjectParams into roslynProtocol.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmalinowski committed Aug 8, 2023
1 parent 8457f04 commit 84bde48
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
10 changes: 0 additions & 10 deletions src/lsptoolshost/openProjectParams.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/lsptoolshost/openSolutionParams.ts

This file was deleted.

10 changes: 6 additions & 4 deletions src/lsptoolshost/roslynLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import ShowInformationMessage from '../shared/observers/utils/showInformationMes
import EventEmitter = require('events');
import Disposable from '../disposable';
import * as RoslynProtocol from './roslynProtocol';
import { OpenSolutionParams } from './openSolutionParams';
import { OpenProjectParams } from './openProjectParams';
import { CSharpDevKitExports } from '../csharpDevKitExports';
import { ISolutionSnapshotProvider, SolutionSnapshotId } from './services/ISolutionSnapshotProvider';
import { Options } from '../shared/options';
Expand Down Expand Up @@ -338,14 +336,18 @@ export class RoslynLanguageServer {
if (this._languageClient !== undefined && this._languageClient.isRunning()) {
if (this._solutionFile !== undefined) {
const protocolUri = this._languageClient.clientOptions.uriConverters!.code2Protocol(this._solutionFile);
await this._languageClient.sendNotification('solution/open', new OpenSolutionParams(protocolUri));
await this._languageClient.sendNotification(RoslynProtocol.OpenSolutionNotification.type, {
solution: protocolUri,
});
}

if (this._projectFiles.length > 0) {
const projectProtocolUris = this._projectFiles.map((uri) =>
this._languageClient!.clientOptions.uriConverters!.code2Protocol(uri)
);
await this._languageClient.sendNotification('project/open', new OpenProjectParams(projectProtocolUris));
await this._languageClient.sendNotification(RoslynProtocol.OpenProjectNotification.type, {
projects: projectProtocolUris,
});
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/lsptoolshost/roslynProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ export interface DebugAttachResult {
didAttach: boolean;
}

export interface OpenSolutionParams {
solution: lsp.DocumentUri;
}

export interface OpenProjectParams {
projects: lsp.DocumentUri[];
}

export namespace WorkspaceDebugConfigurationRequest {
export const method = 'workspace/debugConfiguration';
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
Expand Down Expand Up @@ -159,3 +167,15 @@ export namespace DebugAttachRequest {
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.serverToClient;
export const type = new lsp.RequestType<DebugAttachParams, DebugAttachResult, void>(method);
}

export namespace OpenSolutionNotification {
export const method = 'solution/open';
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
export const type = new lsp.NotificationType<OpenSolutionParams>(method);
}

export namespace OpenProjectNotification {
export const method = 'project/open';
export const messageDirection: lsp.MessageDirection = lsp.MessageDirection.clientToServer;
export const type = new lsp.NotificationType<OpenProjectParams>(method);
}

0 comments on commit 84bde48

Please sign in to comment.