Skip to content

Commit

Permalink
Don't generate organize imports code actions if there are no imports
Browse files Browse the repository at this point in the history
  • Loading branch information
llogick committed Nov 22, 2024
1 parent 60db614 commit 1144732
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/features/code_actions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ fn handleUnorganizedImport(builder: *Builder, actions: *std.ArrayListUnmanaged(t
if (tree.errors.len != 0) return;

const imports = try getImportsDecls(builder, builder.arena);
if (imports.len == 0) return;

// The optimization is disabled because it does not detect the case where imports and other decls are mixed
// if (std.sort.isSorted(ImportDecl, imports.items, tree, ImportDecl.lessThan)) return;
Expand Down

0 comments on commit 1144732

Please sign in to comment.