Skip to content

Commit

Permalink
[dotnet] Experimental change; include project files with the package …
Browse files Browse the repository at this point in the history
…or reference commands.
  • Loading branch information
chrisant996 committed Dec 24, 2024
1 parent ab62dab commit 3897690
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions dotnet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,20 @@ end

local parser = clink.arg.new_parser

local function package_reference_onadvance(arg_index, word, word_index, line_state, user_data)
local function collect_project_files(word, index, line_state, builder) -- luacheck: no unused args
if clink.filematchesexact then
return clink.filematchesexact(word.."*.*proj")
else
return clink.filematches(word)
end
end

local function package_reference_onadvance(arg_index, word, word_index, line_state, user_data) -- luacheck: no unused args, no max line length
if arg_index == 1 then
if word ~= "" and word ~= "package" and word ~= "reference" then
if user_data and not user_data.project_argument then
user_data.project_argument = true
return 0 -- Repeat using the Advance to next argument position BEFORE parsing the word.
return 0 -- Don't advance to the next argument position.
end
end
end
Expand All @@ -196,8 +204,10 @@ end
local package_list = parser({dotnet_complete})
local reference_list = parser({dotnet_complete})
local package_reference_commands = parser({
"reference" .. reference_list,
nosort = true,
"package" .. package_list,
"reference" .. reference_list,
collect_project_files,
onadvance = package_reference_onadvance,
})

Expand Down

0 comments on commit 3897690

Please sign in to comment.