fix: fix warning emitted incorrectly when using ..

This commit is contained in:
nullptrdevs 2022-08-25 16:13:58 -07:00 committed by GitHub
parent 8cf96fe27c
commit b7a5ab5f52
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 = tree.tokenSlice(import_str_token);
if (std.mem.startsWith(u8, import_str, "\".")) {
if (std.mem.startsWith(u8, import_str, "\"./")) {
try diagnostics.append(allocator, .{
.range = astLocationToRange(tree.tokenLocation(0, import_str_token)),
.severity = .Hint,
.code = "useless_dot",
.code = "dot_slash_import",
.source = "zls",
.message = "A . or ./ is not needed in imports",
.message = "A ./ is not needed in imports",
});
}
}