Merge pull request #215 from vesim987/master

Fix inStream/outStream removal
This commit is contained in:
Auguste Rame 2021-01-10 10:58:38 -05:00 committed by GitHub
commit 797c018d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -64,9 +64,9 @@ pub fn collectDocComments(
pub fn getFunctionSignature(tree: *ast.Tree, func: *ast.Node.FnProto) []const u8 {
const start = tree.token_locs[func.firstToken()].start;
const end = tree.token_locs[switch (func.return_type) {
.Explicit, .InferErrorSet => |node| node.lastToken(),
.Invalid => |r_paren| r_paren,
}].end;
.Explicit, .InferErrorSet => |node| node.lastToken(),
.Invalid => |r_paren| r_paren,
}].end;
return tree.source[start..end];
}
@ -80,7 +80,7 @@ pub fn getFunctionSnippet(allocator: *std.mem.Allocator, tree: *ast.Tree, func:
try buffer.appendSlice(tree.tokenSlice(name_tok));
try buffer.append('(');
var buf_stream = buffer.outStream();
var buf_stream = buffer.writer();
for (func.paramsConst()) |param, param_num| {
if (skip_self_param and param_num == 0) continue;
@ -2006,7 +2006,7 @@ pub const DocumentScope = struct {
while (decl_it.next()) |name_decl| : (idx += 1) {
if (idx != 0) log.debug(", ", .{});
}
log.debug("{s}", .{name_decl.key});
log.debug("{s}", .{name_decl.key});
log.debug("\n--------------------------\n", .{});
}
}

View File

@ -88,7 +88,7 @@ pub fn log(
}
// Code is largely based off of https://github.com/andersfr/zig-lsp/blob/master/server.zig
var stdout: std.io.BufferedOutStream(4096, std.fs.File.OutStream) = undefined;
var stdout: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;
var allocator: *std.mem.Allocator = undefined;
var document_store: DocumentStore = undefined;
@ -155,7 +155,7 @@ fn respondGeneric(id: types.RequestId, response: []const u8) !void {
// Numbers of character that will be printed from this string: len - 1 brackets
const json_fmt = "{{\"jsonrpc\":\"2.0\",\"id\":";
const stdout_stream = stdout.outStream();
const stdout_stream = stdout.writer();
try stdout_stream.print("Content-Length: {}\r\n\r\n" ++ json_fmt, .{response.len + id_len + json_fmt.len - 1});
switch (id) {
.Integer => |int| try stdout_stream.print("{}", .{int}),
@ -203,7 +203,7 @@ fn publishDiagnostics(arena: *std.heap.ArenaAllocator, handle: DocumentStore.Han
var mem_buffer: [256]u8 = undefined;
var fbs = std.io.fixedBufferStream(&mem_buffer);
try tree.renderError(err, fbs.outStream());
try tree.renderError(err, fbs.writer());
try diagnostics.append(.{
.range = astLocationToRange(loc),
@ -1536,7 +1536,7 @@ pub fn main() anyerror!void {
// Init global vars
const reader = std.io.getStdIn().reader();
stdout = std.io.bufferedOutStream(std.io.getStdOut().outStream());
stdout = std.io.bufferedWriter(std.io.getStdOut().writer());
// Read the configuration, if any.
const config_parse_options = std.json.ParseOptions{ .allocator = allocator };

View File

@ -14,7 +14,7 @@ pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
var buf = std.ArrayList(u8).init(allocator);
try buf.appendSlice(prefix);
const out_stream = buf.outStream();
const out_stream = buf.writer();
for (path) |char| {
if (char == std.fs.path.sep) {
@ -41,7 +41,7 @@ pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
return buf.toOwnedSlice();
}
pub const UriParseError = error {
pub const UriParseError = error{
UriBadScheme,
UriBadHexChar,
UriBadEscape,