File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ function def:create_win(bufnr, root_dir)
121121 if util .ismac and (vim .bo [bufnr ].filetype == ' c' or vim .bo [bufnr ].filetype == ' cpp' ) then
122122 fname = util .sub_mac_c_header (fname )
123123 end
124+ if vim .bo [bufnr ].filetype == ' rust' then
125+ fname = util .sub_rust_toolchains (fname )
126+ end
127+
124128 if not self .list or vim .tbl_isempty (self .list ) then
125129 local float_opt = {
126130 width = math.floor (api .nvim_win_get_width (0 ) * config .definition .width ),
Original file line number Diff line number Diff line change @@ -235,4 +235,12 @@ function M.get_bold_num()
235235 return num
236236end
237237
238+ function M .sub_rust_toolchains (fname )
239+ local rustup_home = os.getenv (' RUSTUP_HOME' ) or vim .fs .joinpath (vim .env .HOME , ' .rustup' )
240+ local toolchains = vim .fs .joinpath (rustup_home , ' toolchains' )
241+ local parts = vim .split (fname , M .path_sep , { trimempty = true })
242+ local count = # vim .split (toolchains , M .path_sep , { trimempty = true })
243+ return vim .fs .joinpath (unpack (parts , count + 1 ))
244+ end
245+
238246return M
You can’t perform that action at this time.
0 commit comments