File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -746,6 +746,29 @@ function cmake.select_build_type(callback)
746746 )
747747end
748748
749+ function cmake .scan_for_kits (callback )
750+ callback = type (callback ) == " function" and callback
751+ or function (result )
752+ if result :is_ok () then
753+ cmake .generate ({ bang = false , fargs = {} }, nil )
754+ end
755+ end
756+ if check_active_job_and_notify (callback ) then
757+ return
758+ end
759+
760+ if get_cmake_configuration_or_notify (callback ) == nil then
761+ return
762+ end
763+
764+ local kits = scanner .scan_for_kits ()
765+ if kits then
766+ callback (Result :new (Types .SUCCESS , nil , nil ))
767+ else
768+ callback (Result :new_error (Types .CANNOT_FIND_CMAKE_KITS , " Cannot find CMakeKits file" ))
769+ end
770+ end
771+
749772function cmake .select_kit (callback )
750773 callback = type (callback ) == " function" and callback
751774 or function (result )
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ local Types = {
1818 " ANOTHER_JOB_RUNNING" ,
1919 " CMAKE_RUN_FAILED" ,
2020 " SETTINGS_ALREADY_OPENED" ,
21+ " CANNOT_FIND_CMAKE_KITS" ,
2122}
2223
2324Types [0 ] = " SUCCESS"
Original file line number Diff line number Diff line change @@ -186,6 +186,15 @@ vim.api.nvim_create_user_command(
186186 desc = " CMake select cmake kit" ,
187187 }
188188)
189+ --- CMake scan for kits
190+ vim .api .nvim_create_user_command (
191+ " CMakeScanForKits" , -- name
192+ cmake_tools .scan_for_kits , -- command
193+ { -- opts
194+ nargs = 0 ,
195+ desc = " CMake scan for cmake kits" ,
196+ }
197+ )
189198
190199--- CMake select configure preset
191200vim .api .nvim_create_user_command (
You can’t perform that action at this time.
0 commit comments