Merge pull request #385 from leecannon/update_to_master

Update to master
This commit is contained in:
Auguste Rame 2021-09-01 17:27:14 -04:00 committed by GitHub
commit e472fca3be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 24 deletions

View File

@ -1764,14 +1764,10 @@ fn addOutlineNodes(allocator: *std.mem.Allocator, tree: ast.Tree, child: ast.Nod
.@"while",
.while_simple,
.while_cont,
.true_literal,
.false_literal,
.null_literal,
.@"defer",
.@"if",
.if_simple,
.multiline_string_literal,
.undefined_literal,
.@"anytype",
.block,
.block_semicolon,
@ -3225,10 +3221,6 @@ fn makeScopeInternal(
.char_literal,
.integer_literal,
.float_literal,
.false_literal,
.true_literal,
.null_literal,
.undefined_literal,
.unreachable_literal,
.@"continue",
=> {},

View File

@ -446,10 +446,6 @@ pub fn lastToken(tree: ast.Tree, node: ast.Node.Index) ast.TokenIndex {
.char_literal,
.integer_literal,
.float_literal,
.false_literal,
.true_literal,
.null_literal,
.undefined_literal,
.unreachable_literal,
.identifier,
.deref,

View File

@ -107,7 +107,7 @@ const Builder = struct {
// TODO More highlighting here
const tok_id = tree.tokens.items(.tag)[tok];
const tok_type: TokenType = switch (tok_id) {
.keyword_true, .keyword_false, .keyword_null, .keyword_undefined, .keyword_unreachable => .keywordLiteral,
.keyword_unreachable => .keywordLiteral,
.integer_literal, .float_literal => .number,
.string_literal, .multiline_string_literal_line, .char_literal => .string,
.period, .comma, .r_paren, .l_paren, .r_brace, .l_brace, .semicolon, .colon => return,
@ -770,12 +770,7 @@ fn writeNodeTokens(
while (cur_tok <= last_tok) : (cur_tok += 1) try writeToken(builder, cur_tok, .string);
},
.true_literal,
.false_literal,
.null_literal,
.undefined_literal,
.unreachable_literal,
=> {
.unreachable_literal => {
try writeToken(builder, main_token, .keywordLiteral);
},
.error_set_decl => {

View File

@ -176,11 +176,15 @@ test "Request completion in an empty file" {
test "Request completion with no trailing whitespace" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
// FIXME: The last `server.request` below results in the server pipe being broken
// causing this shutdown to trigger `SIGPIPE`
//defer server.shutdown();
try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"const std = @import(\"std\");\nc"}}
, null);
try server.request("textDocument/completion",
\\{"textDocument":{"uri":"file:///test.zig"}, "position":{"line":1,"character":1}}
,
@ -190,7 +194,10 @@ test "Request completion with no trailing whitespace" {
test "Encoded space in file name and usingnamespace on non-existing symbol" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
// FIXME: The last `server.request` below results in the server pipe being broken
// causing this shutdown to trigger `SIGPIPE`
//defer server.shutdown();
try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file:///%20test.zig","languageId":"zig","version":420,"text":"usingnamespace a.b;\nb."}}
@ -204,7 +211,11 @@ test "Encoded space in file name and usingnamespace on non-existing symbol" {
test "Self-referential definition" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
// FIXME: The last `server.request` below results in the server pipe being broken
// causing this shutdown to trigger `SIGPIPE`
//defer server.shutdown();
try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"const h = h(0);\nc"}}
, null);
@ -216,7 +227,11 @@ test "Self-referential definition" {
}
test "Missing return type" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
// FIXME: The last `server.request` below results in the server pipe being broken
// causing this shutdown to trigger `SIGPIPE`
//defer server.shutdown();
try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"fn w() {}\nc"}}
, null);
@ -229,7 +244,11 @@ test "Missing return type" {
test "Pointer and optional deref" {
var server = try Server.start(initialize_msg, null);
defer server.shutdown();
// FIXME: The last `server.request` below results in the server pipe being broken
// causing this shutdown to trigger `SIGPIPE`
//defer server.shutdown();
try server.request("textDocument/didOpen",
\\{"textDocument":{"uri":"file:///test.zig","languageId":"zig","version":420,"text":"var value: ?struct { data: i32 = 5 } = null;const ptr = &value;\nconst a = ptr.*.?."}}
, null);