Skip to content

Commit eb589ef

Browse files
roll sample server and extension back to 'just work'
1 parent dca32a6 commit eb589ef

File tree

2 files changed

+28
-40
lines changed

2 files changed

+28
-40
lines changed

sample/SampleServer/Program.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System;
2-
using System.Diagnostics;
3-
using System.IO.Pipelines;
4-
using System.IO.Pipes;
52
using System.Threading.Tasks;
63
using Microsoft.Extensions.Configuration;
74
using Microsoft.Extensions.DependencyInjection;
@@ -10,7 +7,6 @@
107
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
118
using OmniSharp.Extensions.LanguageServer.Server;
129
using Serilog;
13-
using PipeOptions = System.IO.Pipes.PipeOptions;
1410

1511
namespace SampleServer
1612
{
@@ -32,23 +28,19 @@ static async Task MainAsync(string[] args)
3228
Log.Logger = new LoggerConfiguration()
3329
.Enrich.FromLogContext()
3430
.WriteTo.File("log.txt", rollingInterval: RollingInterval.Day)
35-
.WriteTo.Debug()
3631
.MinimumLevel.Verbose()
3732
.CreateLogger();
3833

39-
var pipe = new NamedPipeServerStream("samplepipe", PipeDirection.InOut, -1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
40-
await pipe.WaitForConnectionAsync();
41-
4234
Log.Logger.Information("This only goes file...");
4335

4436
IObserver<WorkDoneProgressReport> workDone = null;
4537

4638
var server = await LanguageServer.From(options =>
4739
options
48-
.WithInput(pipe)
49-
.WithOutput(pipe)
40+
.WithInput(Console.OpenStandardInput())
41+
.WithOutput(Console.OpenStandardOutput())
5042
.ConfigureLogging(x => x
51-
.AddSerilog(Log.Logger)
43+
.AddSerilog()
5244
.AddLanguageProtocolLogging()
5345
.SetMinimumLevel(LogLevel.Debug))
5446
.WithHandler<TextDocumentHandler>()

vscode-testextension/src/extension.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,38 @@ export function activate(context: ExtensionContext) {
2525
// The server is implemented in node
2626
let serverExe = "dotnet";
2727

28-
// let serverExe = 'D:\\Development\\Omnisharp\\csharp-language-server-protocol\\sample\\SampleServer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\SampleServer.exe';
28+
// let serverExe = "D:\\Development\\Omnisharp\\csharp-language-server-protocol\\sample\\SampleServer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\SampleServer.exe";
2929
// let serverExe = "D:/Development/Omnisharp/omnisharp-roslyn/artifacts/publish/OmniSharp.Stdio.Driver/win7-x64/OmniSharp.exe";
3030
// The debug options for the server
3131
// let debugOptions = { execArgv: ['-lsp', '-d' };5
3232

3333
// If the extension is launched in debug mode then the debug server options are used
3434
// Otherwise the run options are used
35-
// let serverOptions: ServerOptions = {
36-
// // run: { command: serverExe, args: ['-lsp', '-d'] },
37-
// run: {
38-
// command: serverExe,
39-
// args: [
40-
// "D:/Development/Omnisharp/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"
41-
// ],
42-
// transport: TransportKind.pipe
43-
// },
44-
// // debug: { command: serverExe, args: ['-lsp', '-d'] }
45-
// debug: {
46-
// command: serverExe,
47-
// args: [
48-
// "D:/Development/Omnisharp/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"
49-
// ],
50-
// transport: TransportKind.pipe,
51-
// runtime: '',
52-
// }
53-
// };
54-
let time = 100;
55-
let serverOptions = async () => {
56-
await new Promise((r) => setTimeout(r, time));
57-
time = 10000;
58-
const [reader, writer] = createServerPipeTransport("\\\\.\\pipe\\" + "samplepipe");
59-
return {
60-
reader,
61-
writer,
62-
};
35+
let serverOptions: ServerOptions = {
36+
// run: { command: serverExe, args: ['-lsp', '-d'] },
37+
run: {
38+
command: serverExe,
39+
args: ["D:/Development/Omnisharp/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"],
40+
transport: TransportKind.pipe,
41+
},
42+
// debug: { command: serverExe, args: ['-lsp', '-d'] }
43+
debug: {
44+
command: serverExe,
45+
args: ["D:/Development/Omnisharp/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"],
46+
transport: TransportKind.pipe,
47+
runtime: "",
48+
},
6349
};
50+
// let time = 100;
51+
// let serverOptions = async () => {
52+
// await new Promise((r) => setTimeout(r, time));
53+
// time = 10000;
54+
// const [reader, writer] = createServerPipeTransport("\\\\.\\pipe\\" + "samplepipe");
55+
// return {
56+
// reader,
57+
// writer,
58+
// };
59+
// };
6460

6561
// Options to control the language client
6662
let clientOptions: LanguageClientOptions = {

0 commit comments

Comments
 (0)