vekatze / neut

A functional programming language with static memory management
https://vekatze.github.io/neut/
MIT License
840 stars 11 forks source link

remove unused items in `import {..}` only when required (for better LSP experience) #207

Closed vekatze closed 1 month ago

vekatze commented 1 month ago

before

after

benchmark

# format ← (used by textDocument/formatting)
❯ hyperfine "neut format-source source/neural.nt"
Benchmark 1: neut format-source source/neural.nt
  Time (mean ± σ):      33.6 ms ±   1.3 ms    [User: 14.9 ms, System: 15.8 ms]
  Range (min … max):    30.4 ms …  36.1 ms    82 runs

# format + remove used items in `import {..}` ← (used by textDocument/codeAction)
❯ hyperfine "neut format-source --minimize-imports source/neural.nt"
Benchmark 1: neut format-source --minimize-imports source/neural.nt
  Time (mean ± σ):     135.7 ms ±   7.4 ms    [User: 245.9 ms, System: 74.6 ms]
  Range (min … max):   124.3 ms … 148.8 ms    19 runs