Skip to content

Commit 8b44882

Browse files
committed
minor refactors
1 parent f76d4bf commit 8b44882

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

examples/hello_client.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn main() !void {
5959

6060
var threaded: std.Io.Threaded = .init(gpa);
6161
defer threaded.deinit();
62-
const io = threaded.io();
62+
const io = threaded.ioBasic();
6363

6464
const args = try std.process.argsAlloc(gpa);
6565
defer std.process.argsFree(gpa, args);

examples/hello_server.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn main() !void {
4343

4444
var threaded: std.Io.Threaded = .init(gpa);
4545
defer threaded.deinit();
46-
const io = threaded.io();
46+
const io = threaded.ioBasic();
4747

4848
// Language servers can support multiple communication channels (e.g. stdio, pipes, sockets).
4949
// See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#implementationConsiderations

examples/my_first_server.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const builtin = @import("builtin");
55
const lsp = @import("lsp");
66

77
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
8-
var log_transport: ?lsp.AnyTransport = null;
98

109
pub fn main() !void {
1110
const gpa, const is_debug = switch (builtin.mode) {
@@ -18,7 +17,7 @@ pub fn main() !void {
1817

1918
var threaded: std.Io.Threaded = .init(gpa);
2019
defer threaded.deinit();
21-
const io = threaded.io();
20+
const io = threaded.ioBasic();
2221

2322
// LSP implementations typically communicate over stdio (stdin and stdout)
2423
var read_buffer: [256]u8 = undefined;
@@ -196,7 +195,7 @@ pub const Handler = struct {
196195
return;
197196
};
198197

199-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
198+
var buffer: std.ArrayList(u8) = .empty;
200199
errdefer buffer.deinit(self.allocator);
201200

202201
try buffer.appendSlice(self.allocator, current_text.*);

src/codegen/config.zon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
.{"CodeActionClientCapabilities", .{ .rename = "ClientCapabilities.TextDocument.CodeAction" } },
162162
.{"ClientCodeActionLiteralOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeAction.LiteralOptions" } },
163163
.{"ClientCodeActionKindOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeAction.KindOptions" } },
164-
.{ "ClientCodeActionResolveOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeAction.ResolveOptions" } },
164+
.{"ClientCodeActionResolveOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeAction.ResolveOptions" } },
165165
.{"CodeActionTagOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeAction.TagOptions" } },
166166
.{"CodeLensClientCapabilities", .{ .rename = "ClientCapabilities.TextDocument.CodeLens" } },
167167
.{"ClientCodeLensResolveOptions", .{ .rename = "ClientCapabilities.TextDocument.CodeLens.ResolveOptions" } },
@@ -259,8 +259,8 @@
259259
// textDocument/prepareRename
260260
.{"PrepareRenameParams", .{ .rename = "prepare_rename.Params" } },
261261
.{"PrepareRenameResult", .{ .rename = "prepare_rename.Result" } },
262-
.{"PrepareRenameDefaultBehavior", .{ .rename = "prepare_rename.DefaultBehavior" } },
263-
.{"PrepareRenamePlaceholder", .{ .rename = "prepare_rename.Placeholder" } },
262+
.{"PrepareRenameDefaultBehavior", .{ .rename = "prepare_rename.DefaultBehavior" } },
263+
.{"PrepareRenamePlaceholder", .{ .rename = "prepare_rename.Placeholder" } },
264264

265265
.{"RenameParams", .{ .rename = "rename.Params" } },
266266
.{"RenameOptions", .{ .rename = "rename.Options" } },

src/lsp.zig

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,7 @@ pub fn writeRequest(
13421342
}
13431343

13441344
test writeRequest {
1345-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
1346-
var aw: std.Io.Writer.Allocating = .fromArrayList(std.testing.allocator, &buffer);
1345+
var aw: std.Io.Writer.Allocating = .init(std.testing.allocator);
13471346
defer aw.deinit();
13481347

13491348
try writeRequest(
@@ -1384,8 +1383,7 @@ pub fn writeNotification(
13841383
}
13851384

13861385
test writeNotification {
1387-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
1388-
var aw: std.Io.Writer.Allocating = .fromArrayList(std.testing.allocator, &buffer);
1386+
var aw: std.Io.Writer.Allocating = .init(std.testing.allocator);
13891387
defer aw.deinit();
13901388

13911389
try writeNotification(
@@ -1424,8 +1422,7 @@ pub fn writeResponse(
14241422
}
14251423

14261424
test writeResponse {
1427-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
1428-
var aw: std.Io.Writer.Allocating = .fromArrayList(std.testing.allocator, &buffer);
1425+
var aw: std.Io.Writer.Allocating = .init(std.testing.allocator);
14291426
defer aw.deinit();
14301427

14311428
try writeResponse(
@@ -1463,8 +1460,7 @@ pub fn writeErrorResponse(
14631460
}
14641461

14651462
test writeErrorResponse {
1466-
var buffer: std.ArrayListUnmanaged(u8) = .empty;
1467-
var aw: std.Io.Writer.Allocating = .fromArrayList(std.testing.allocator, &buffer);
1463+
var aw: std.Io.Writer.Allocating = .init(std.testing.allocator);
14681464
defer aw.deinit();
14691465

14701466
try writeErrorResponse(

0 commit comments

Comments
 (0)