Qt Creator terminal integration #453
-
Qt Creator 11 will get terminal integration. I would like to have the best Currently there are two issues:
The shell integration we took (MIT licensed) from VS Code https://github.com/microsoft/vscode/tree/main/src/vs/workbench/contrib/terminal/browser/media How should Qt Creator change the environment where |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
Re: "light theme" -- see the (long) discussion in #256. Re: "shell integration so the user doesn't have to configure Clink" -- I think you mean you want a default "shell integration" in case the user hasn't configured Clink at all yet. I don't think you should try to override/replace user configuration. Can you describe what kinds of shell integration are desired? If you just want to set a default prompt string, that's not a Clink question, it's a CMD question. Run |
Beta Was this translation helpful? Give feedback.
-
I've made a script for vscode shell integration, which I'll publish in the clink-gizmos repo soon. Here it is. Presumably Qt Creator will set Important: Be sure to rename the -- luacheck: globals gizmo_vscode_shell_integration NONL
if gizmo_vscode_shell_integration == nil then
gizmo_vscode_shell_integration = true
end
if not gizmo_vscode_shell_integration then
return
end
local function is_vscode()
local term_program = os.getenv("term_program") or ""
if term_program:lower() == "vscode" then
return true
end
end
local function send_context()
if is_vscode() then
local codes = ""
codes = codes .. "\027]633;D;" .. os.geterrorlevel() .. "\a" -- send command exit code
codes = codes .. "\027]633;P;Cwd=" .. os.getcwd() .. "\a" -- send cwd as title
clink.print(codes, NONL)
end
end
local p = clink.promptfilter(-999)
function p:filter() -- luacheck: no unused
-- Nothing to do here, but the filter function must be defined.
end
function p:surround() -- luacheck: no unused
if is_vscode() then
local pre, suf
local rpre, rsuf
-- ESC codes surrounding prompt string
pre = "\027]633;A\a" -- copied from shellIntegration-rc.zsh
suf = "\027]633;B\a" -- copied from shellIntegration-rc.zsh
-- ESC codes surrounding right side prompt string
rpre = "\027]633;H\a" -- copied from shellIntegration-rc.zsh
rsuf = "\027]633;I\a" -- copied from shellIntegration-rc.zsh
return pre, suf, rpre, rsuf
end
end
clink.onbeginedit(send_context) |
Beta Was this translation helpful? Give feedback.
@cristianadam Oh! It's even easier! Since Qt Creator only wants exit code and cwd, that's already fully possible with Clink as-is, for probably at least a year.
Instead of using a prompt filter, just use
onbeginedit
:And use the example .cmd script from the earlier reply to load the Lua script.