Open Techatrix opened 2 years ago
[ ] rewrite string literal <-> multiline string:
const greeting = "hello,\nworld";
// <->
const greeting =
\\hello,
\\world
;
Add support for const-var autofix.
var a = 1;
_ = a;
src/main.zig:18:9: error: local variable is never mutated
var a = 1;
^
src/main.zig:18:9: note: consider using 'const'
const a = 1;
a = 10;
src/main.zig:19:5: error: cannot assign to constant
a = 10;
^
Mentioned that this feature already implemented in https://www.reddit.com/r/Zig/comments/1debk2j/, but turns out that "no".
Add support for const-var autofix.
This code action has been implemented in #1607 but removed as an "autofix" in #1652 because it is not reversible. There is no error in zig ast-check
for "constant variable is mutated; consider using 'var'". If Zig were to emit this kind of error, then it can be reintroduced as an autofix.
May Zig in near future start emitting this error?
This issue contains a collection of possible code actions that can be integrated into zls. Some of them may not be easily implementable without #551 or #552. Feel free to make suggestions if you have some ideas.
Unused Parameter
Unused Variable/Constant
[ ] remove variable/constant
[x] discard variable/constant (part of autofix)
Capture
Unreachable code
Formatting
Sort Imports
const alpha = @import("alpha"); const beta = @import("beta"); const gamma = @import("gamma");
const delta = @import("delta.zig"); const epsilon = @import("epsilon.zig"); const zeta = @import("zeta.zig");
Functions should be camelCase
Type functions should be PascalCase
Refactor
Extract Variable/Constant
Extract type specififer
Sema
Create init/deinit function
[ ] create init function
[ ] create deinit function
Explicitly specify error union
[ ] explicitly specify error union (inline)
[ ] explicitly specify error union (extern)
[ ] explicitly specify error union (inline, structured)
[ ] explicitly specify error union (extern, structured)
Specify missing switch cases
Expand else switch cases
Fix all bugs