Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vscode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function vscode.generateProject(prj)
p.indent(" ")

if project.isc(prj) or project.iscpp(prj) then
p.generate(prj, prj.location .. '/' .. prj.name .. "/.vscode/tasks.json", vscode.project.vscode_tasks)
p.generate(prj, prj.location .. '/' .. prj.name .. "/.vscode/launch.json", vscode.project.vscode_launch)
p.generate(prj, prj.location .. '/' .. prj.name .. "/.vscode/c_cpp_properties.json", vscode.project.vscode_c_cpp_properties)
p.generate(prj, prj.location .. "/.vscode/tasks.json", vscode.project.vscode_tasks)
p.generate(prj, prj.location .. "/.vscode/launch.json", vscode.project.vscode_launch)
p.generate(prj, prj.location .. "/.vscode/c_cpp_properties.json", vscode.project.vscode_c_cpp_properties)
end
end

Expand Down
18 changes: 2 additions & 16 deletions vscode_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,7 @@ end
-- VS Code only scans for project files inside the project's directory, so symlink them into
-- the project's directory.
function m.files(prj)
local node_path = ''
local tr = project.getsourcetree(prj)
tree.traverse(tr, {
onbranchenter = function(node, depth)
node_path = node_path .. '/' .. node.name
end,
onbranchexit = function(node, depth)
node_path = node_path:sub(1, node_path:len()-(node.name:len()+1))
end,
onleaf = function(node, depth)
local full_path = prj.location .. node_path
os.mkdir(full_path)
symlink(node.abspath, full_path)
end
}, true)

end


Expand Down Expand Up @@ -123,7 +109,7 @@ function m.vscode_launch(prj)
else
_p(1, ',{')
end
_p(2, '"name": "%s: Build and debug",', prj.name)
_p(2, '"name": "%s (%s): Build and debug",', prj.name,cfg.platform)
_p(2, '"type": "cppdbg",')
_p(2, '"request": "launch",')
_p(2, '"program": "%s/%s",', cfg.buildtarget.directory, prj.name)
Expand Down
2 changes: 1 addition & 1 deletion vscode_workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function m.generate(wks)
local prj = n.project

-- Build a relative path from the workspace file to the project file
local prjpath = path.getrelative(prj.workspace.location, prj.location .. '/' .. prj.name)
local prjpath = path.getrelative(prj.workspace.location, prj.location)
p.w('{')
p.w('"path": "%s"', prjpath)
p.w('},')
Expand Down