Merge pull request #607 from nullptrdevs/minor

fix: fix warning emitted incorrectly when using ..
This commit is contained in:
Lee Cannon 2022-08-26 18:15:40 +01:00 committed by GitHub
commit 8acf0f08c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,13 +324,13 @@ fn publishDiagnostics(server: *Server, writer: anytype, handle: DocumentStore.Ha
const import_str_token = tree.nodes.items(.main_token)[params[0]]; const import_str_token = tree.nodes.items(.main_token)[params[0]];
const import_str = tree.tokenSlice(import_str_token); const import_str = tree.tokenSlice(import_str_token);
if (std.mem.startsWith(u8, import_str, "\".")) { if (std.mem.startsWith(u8, import_str, "\"./")) {
try diagnostics.append(allocator, .{ try diagnostics.append(allocator, .{
.range = astLocationToRange(tree.tokenLocation(0, import_str_token)), .range = astLocationToRange(tree.tokenLocation(0, import_str_token)),
.severity = .Hint, .severity = .Hint,
.code = "useless_dot", .code = "dot_slash_import",
.source = "zls", .source = "zls",
.message = "A . or ./ is not needed in imports", .message = "A ./ is not needed in imports",
}); });
} }
} }