File tree Expand file tree Collapse file tree 1 file changed +34
-2
lines changed
Expand file tree Collapse file tree 1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change 11local subprocess_check_output = require (' lean._util' ).subprocess_check_output
2- local elan = {}
2+ local elan = { toolchain = {} }
3+
4+ --- Elan's dumped state, which can partially change from project to project.
5+ --- @class ElanState
6+ --- @field elan_version ElanVersionInfo
7+ --- @field toolchains ElanToolchainInfo
8+
9+ --- @class ElanVersionInfo
10+ --- @field current string elan ' s own version
11+ --- @field newest table
12+
13+ --- Information about installed and active Lean toolchains.
14+ --- @class ElanToolchainInfo
15+ --- @field active_override ? table information about an overridden toolchain for the current project
16+ --- @field default ? table information about the default toolchain
17+ --- @field installed ElanToolchain[] the currently installed toolchains
18+ --- @field resolved_active table information about the resolved active toolchain
19+
20+ --- A single toolchain.
21+ --- @class ElanToolchain
22+ --- @field path string the path to the toolchain on this machine
23+ --- @field resolved_name string the identifier for this toolchain
24+
25+ -- List the installed toolchains.
26+ function elan .toolchain .list ()
27+ local state = elan .state ()
28+ return vim
29+ .iter (state .toolchains .installed )
30+ :map (function (each )
31+ return each .resolved_name
32+ end )
33+ :totable ()
34+ end
335
436--- Dump elan's state.
5- --- @return table
37+ --- @return ElanState
638function elan .state ()
739 local stdout = subprocess_check_output { ' elan' , ' dump-state' }
840 return vim .json .decode (stdout )
You can’t perform that action at this time.
0 commit comments