Skip to content

Commit 46956f3

Browse files
committed
comments
1 parent 72a80af commit 46956f3

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

lua/compiler/health.lua

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,10 @@ function M.check()
9595
type = "warn",
9696
mag = "Used to call the javascript interpreter.",
9797
},
98-
{
99-
cmd = "npm",
100-
type = "warn",
101-
mag = "Used to call npm from typescript and javascript.",
102-
},
10398
{
10499
cmd = "tsc",
105100
type = "warn",
106-
mag = "Used to transpile typescript to javascript.",
101+
mag = "Used to transpile typescript to javascript. If you install it on your project, it will prevail over the global tsc executable.",
107102
},
108103
{
109104
cmd = "make",

lua/compiler/utils.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
local 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.
1010
function 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
3232
end
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
4646
end
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", ... }
5353
function 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
9191
end
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.
9796
function 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
109108
end
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
113112
function M.file_exists(filename)
114113
local stat = vim.loop.fs_stat(filename)
115114
return stat and stat.type == "file"
116115
end
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.
121121
function 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
129129
end
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.
135135
function M.os_path(path)
136136
if path == nil then return nil end
137137
-- Get the platform-specific path separator

0 commit comments

Comments
 (0)