Skip to content

Unused argument produces 0 width diagnostic #627

@gcoakes

Description

@gcoakes

Zig Version

v0.10.0-dev.3877+3deb33fff

Zig Language Server Version

fc4609a

Steps to Reproduce

Any unused argument.

const std = @import("std");
const testing = std.testing;

export fn add(a: i32, b: i32) i32 {
    return a;
}

test "basic add functionality" {
    try testing.expect(add(3, 7) == 10);
}

Expected Behavior

A diagnostic would be produced which covers the span of 3:22 to 3:23 (where line:column).

Actual Behavior

This is from my editor's (helix) verbose logging:

2022-09-05T10:15:41.571 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/gcoakes/src/repro/src/main.zig","diagnostics":[{"range":{"start":{"line":3,"character":22},"end":{"line":3,"character":22}},"severity":1,"code":"ast_check","source":"zls","message":"unused function parameter","relatedInformation":[]}]}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions