22
33local M = {}
44
5- --- Recursively searches for files with the given name
6- -- in all directories under start_dir.
7- --- @param start_dir string
8- --- @param file_name string
9- --- @return table files Empty table if no files found .
5+ --- Recursively searches for files with the given name
6+ -- in all directories under start_dir.
7+ --- @param start_dir string A dir path string.
8+ --- @param file_name string A file path string.
9+ --- @return table files If any , a tables of files. Otherwise , a Empty table .
1010function M .find_files (start_dir , file_name )
1111 local files = {}
1212
@@ -31,8 +31,8 @@ function M.find_files(start_dir, file_name)
3131 return files
3232end
3333
34- --- Search recursively, starting by the directory
35- --- of the entry_point file. Return files matching the pattern.
34+ --- Search recursively, starting by the directory
35+ -- of the entry_point file. Return files matching the pattern.
3636--- @param entry_point string Entry point file of the program.
3737--- @param pattern string File extension to search.
3838--- @return string files_as_string Files separated by a space.
@@ -45,11 +45,11 @@ function M.find_files_to_compile(entry_point, pattern)
4545 return files_as_string
4646end
4747
48- -- Parse the solution file and extract variables.
48+ --- Parse the solution file and extract variables.
4949--- @param file_path string Path of the solution file to read.
5050--- @return table config A table like { { entry_point , ouptput , .. } .. }
51- --- The last table will only contain the solution executables like:
52- --- { "/path/to/executable", ... }
51+ -- The last table will only contain the solution executables like:
52+ -- { "/path/to/executable", ... }
5353function M .parse_solution_file (file_path )
5454 local file = assert (io.open (file_path , " r" ))
5555 local config = {}
@@ -90,10 +90,9 @@ function M.parse_solution_file(file_path)
9090 return config
9191end
9292
93- --- Programatically require the backend for the current language.
94- --- This function is compatible with Unix and Windows.
95- --- @return table | nil language If languages /<filetype>.lua doesn ' t exist,
96- -- send a notification and return nil.
93+ --- Programatically require the backend for the current language.
94+ --- @return table | nil language The language backend.
95+ -- If ./languages/<filetype>.lua doesn't exist, return nil.
9796function M .require_language (filetype )
9897 local local_path = debug.getinfo (1 , " S" ).source :sub (2 )
9998 local local_path_dir = local_path :match (" (.*[/\\ ])" )
@@ -108,16 +107,17 @@ function M.require_language(filetype)
108107 end
109108end
110109
111- --- Function that returns true if a file exists in physical storage
112- --- @return boolean | nil
110+ --- Function that returns true if a file exists in physical storage
111+ --- @return boolean | nil exists true or false
113112function M .file_exists (filename )
114113 local stat = vim .loop .fs_stat (filename )
115114 return stat and stat .type == " file"
116115end
117116
118- --- Function that returns the path of the .solution file if exists in the current
119- --- working diectory root, or nil otherwise.
120- --- @return string | nil
117+ --- Function that returns the path of the .solution file if exists in the current
118+ -- working diectory root, or nil otherwise.
119+ --- @return string | nil path Path of the .solution file if exists in the current
120+ -- working diectory root, or nil otherwise.
121121function M .get_solution_file ()
122122 if M .file_exists (" .solution.toml" ) then
123123 return M .os_path (vim .fn .getcwd () .. " /.solution.toml" )
@@ -128,10 +128,10 @@ function M.get_solution_file()
128128 end
129129end
130130
131- --- Given a string, convert 'slash' to 'inverted slash' if on windows, and vice versa on UNIX.
131+ --- Given a string, convert 'slash' to 'inverted slash' if on windows, and vice versa on UNIX.
132132-- Then return the resulting string.
133- --- @param path string
134- --- @return string | nil,nil
133+ --- @param path string A path string.
134+ --- @return string | nil,nil path A path string formatted for the current OS.
135135function M .os_path (path )
136136 if path == nil then return nil end
137137 -- Get the platform-specific path separator
0 commit comments