20
20
21
21
-- imports
22
22
import (" core.base.option" )
23
+ import (" core.base.hashset" )
23
24
import (" core.tool.compiler" )
24
25
import (" core.project.rule" )
25
26
import (" core.project.project" )
@@ -41,12 +42,21 @@ function _sourcebatch_is_built(sourcebatch)
41
42
local rulename = sourcebatch .rulename
42
43
if rulename == " c.build" or rulename == " c++.build"
43
44
or rulename == " asm.build" or rulename == " cuda.build"
44
- or rulename == " objc.build" or rulename == " objc++.build"
45
- or rulename :startswith (" verilator." ) then
45
+ or rulename == " objc.build" or rulename == " objc++.build" then
46
46
return true
47
47
end
48
48
end
49
49
50
+ -- Is there other supported source file, which come from custom rules?
51
+ function _is_other_sourcefile (sourcefile )
52
+ local extensions = _g ._other_supported_exts
53
+ if extensions == nil then
54
+ extensions = hashset .from ({" .v" , " .sv" })
55
+ _g ._other_supported_exts = extensions
56
+ end
57
+ return extensions :has (path .extension (sourcefile ))
58
+ end
59
+
50
60
-- get LSP, clangd, ccls, ...
51
61
function _get_lsp ()
52
62
local lsp = option .get (" lsp" )
@@ -155,6 +165,10 @@ function _make_arguments(jsonfile, arguments, opt)
155
165
local sourcekind = try {function () return language .sourcekind_of (path .filename (arg )) end }
156
166
if sourcekind and os .isfile (arg ) then
157
167
sourcefile = tostring (arg )
168
+ elseif _is_other_sourcefile (arg ) and os .isfile (arg ) then
169
+ sourcefile = tostring (arg )
170
+ end
171
+ if sourcefile then
158
172
break
159
173
end
160
174
end
0 commit comments