Skip to content

Commit 076b499

Browse files
committed
try to connect via brokered service
1 parent f8fd0c9 commit 076b499

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
"name": "Microsoft.CodeAnalysis.LanguageClient.SolutionSnapshotProvider",
5151
"version": "0.1"
5252
}
53+
},
54+
{
55+
"moniker": {
56+
"name": "Microsoft.VisualStudioCode.CSharp.BuildResultService",
57+
"version": "0.1"
58+
}
5359
}
5460
],
5561
"scripts": {
@@ -4992,4 +4998,4 @@
49924998
}
49934999
]
49945000
}
4995-
}
5001+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
import { CancellationToken } from 'vscode';
6+
7+
interface IBuildResultDiagnostics {
8+
buildStarted(cancellationToken?: CancellationToken): Promise<void>;
9+
reportBuildResult(buildDiagnostics: RegExpExecArray[], cancellationToken?: CancellationToken): Promise<void>;
10+
}
11+
12+
export class BuildResultDiagnostics implements IBuildResultDiagnostics {
13+
public async buildStarted(): Promise<void> {
14+
console.log('build started');
15+
}
16+
17+
public async reportBuildResult(buildDiagnostics: RegExpExecArray[]): Promise<void> {
18+
console.log('received ' + buildDiagnostics.length + ' diagnostics');
19+
}
20+
}

src/lsptoolshost/services/descriptors.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,13 @@ export default class Descriptors {
3232
protocolMajorVersion: 3,
3333
}
3434
);
35+
36+
static readonly csharpExtensionBuildResultService: ServiceRpcDescriptor = new ServiceJsonRpcDescriptor(
37+
ServiceMoniker.create('Microsoft.VisualStudioCode.CSharp.BuildResultService', '0.1'),
38+
Formatters.MessagePack,
39+
MessageDelimiters.BigEndianInt32LengthHeader,
40+
{
41+
protocolMajorVersion: 3,
42+
}
43+
);
3544
}

src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { registerOmnisharpOptionChanges } from './omnisharp/omnisharpOptionChang
5656
import { RoslynLanguageServerEvents } from './lsptoolshost/languageServerEvents';
5757
import { ServerStateChange } from './lsptoolshost/serverStateChange';
5858
import { SolutionSnapshotProvider } from './lsptoolshost/services/solutionSnapshotProvider';
59+
import { BuildResultDiagnostics } from './lsptoolshost/services/buildResultReporterService';
5960

6061
export async function activate(
6162
context: vscode.ExtensionContext
@@ -412,6 +413,10 @@ function profferBrokeredServices(
412413
serviceContainer.profferServiceFactory(
413414
Descriptors.solutionSnapshotProviderRegistration,
414415
(_mk, _op, _sb) => new SolutionSnapshotProvider(languageServerPromise)
416+
),
417+
serviceContainer.profferServiceFactory(
418+
Descriptors.csharpExtensionBuildResultService,
419+
(_mk, _op, _sb) => new BuildResultDiagnostics()
415420
)
416421
);
417422
}

0 commit comments

Comments
 (0)