Merge pull request #215 from vesim987/master
Fix inStream/outStream removal
This commit is contained in:
commit
797c018d57
@ -64,9 +64,9 @@ pub fn collectDocComments(
|
|||||||
pub fn getFunctionSignature(tree: *ast.Tree, func: *ast.Node.FnProto) []const u8 {
|
pub fn getFunctionSignature(tree: *ast.Tree, func: *ast.Node.FnProto) []const u8 {
|
||||||
const start = tree.token_locs[func.firstToken()].start;
|
const start = tree.token_locs[func.firstToken()].start;
|
||||||
const end = tree.token_locs[switch (func.return_type) {
|
const end = tree.token_locs[switch (func.return_type) {
|
||||||
.Explicit, .InferErrorSet => |node| node.lastToken(),
|
.Explicit, .InferErrorSet => |node| node.lastToken(),
|
||||||
.Invalid => |r_paren| r_paren,
|
.Invalid => |r_paren| r_paren,
|
||||||
}].end;
|
}].end;
|
||||||
return tree.source[start..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.appendSlice(tree.tokenSlice(name_tok));
|
||||||
try buffer.append('(');
|
try buffer.append('(');
|
||||||
|
|
||||||
var buf_stream = buffer.outStream();
|
var buf_stream = buffer.writer();
|
||||||
|
|
||||||
for (func.paramsConst()) |param, param_num| {
|
for (func.paramsConst()) |param, param_num| {
|
||||||
if (skip_self_param and param_num == 0) continue;
|
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) {
|
while (decl_it.next()) |name_decl| : (idx += 1) {
|
||||||
if (idx != 0) log.debug(", ", .{});
|
if (idx != 0) log.debug(", ", .{});
|
||||||
}
|
}
|
||||||
log.debug("{s}", .{name_decl.key});
|
log.debug("{s}", .{name_decl.key});
|
||||||
log.debug("\n--------------------------\n", .{});
|
log.debug("\n--------------------------\n", .{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ pub fn log(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Code is largely based off of https://github.com/andersfr/zig-lsp/blob/master/server.zig
|
// 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 allocator: *std.mem.Allocator = undefined;
|
||||||
|
|
||||||
var document_store: DocumentStore = 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
|
// Numbers of character that will be printed from this string: len - 1 brackets
|
||||||
const json_fmt = "{{\"jsonrpc\":\"2.0\",\"id\":";
|
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});
|
try stdout_stream.print("Content-Length: {}\r\n\r\n" ++ json_fmt, .{response.len + id_len + json_fmt.len - 1});
|
||||||
switch (id) {
|
switch (id) {
|
||||||
.Integer => |int| try stdout_stream.print("{}", .{int}),
|
.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 mem_buffer: [256]u8 = undefined;
|
||||||
var fbs = std.io.fixedBufferStream(&mem_buffer);
|
var fbs = std.io.fixedBufferStream(&mem_buffer);
|
||||||
try tree.renderError(err, fbs.outStream());
|
try tree.renderError(err, fbs.writer());
|
||||||
|
|
||||||
try diagnostics.append(.{
|
try diagnostics.append(.{
|
||||||
.range = astLocationToRange(loc),
|
.range = astLocationToRange(loc),
|
||||||
@ -1536,7 +1536,7 @@ pub fn main() anyerror!void {
|
|||||||
|
|
||||||
// Init global vars
|
// Init global vars
|
||||||
const reader = std.io.getStdIn().reader();
|
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.
|
// Read the configuration, if any.
|
||||||
const config_parse_options = std.json.ParseOptions{ .allocator = allocator };
|
const config_parse_options = std.json.ParseOptions{ .allocator = allocator };
|
||||||
|
@ -14,7 +14,7 @@ pub fn fromPath(allocator: *std.mem.Allocator, path: []const u8) ![]const u8 {
|
|||||||
var buf = std.ArrayList(u8).init(allocator);
|
var buf = std.ArrayList(u8).init(allocator);
|
||||||
try buf.appendSlice(prefix);
|
try buf.appendSlice(prefix);
|
||||||
|
|
||||||
const out_stream = buf.outStream();
|
const out_stream = buf.writer();
|
||||||
|
|
||||||
for (path) |char| {
|
for (path) |char| {
|
||||||
if (char == std.fs.path.sep) {
|
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();
|
return buf.toOwnedSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const UriParseError = error {
|
pub const UriParseError = error{
|
||||||
UriBadScheme,
|
UriBadScheme,
|
||||||
UriBadHexChar,
|
UriBadHexChar,
|
||||||
UriBadEscape,
|
UriBadEscape,
|
||||||
|
Loading…
Reference in New Issue
Block a user