fix generic mark hover (#153385)

This commit is contained in:
Megan Rogge 2022-06-27 18:52:52 -04:00 committed by GitHub
parent 0a435fb5b1
commit 87e684ef9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View file

@ -308,13 +308,12 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
return false;
}
const [command, hoverMessage, disableCommandStorage] = data.split(';');
const [command] = data.split(';');
switch (command) {
case ITermOscPt.SetMark: {
this._createOrGetCommandDetection(this._terminal).handleGenericCommand({ genericMarkProperties: { hoverMessage: hoverMessage || '', disableCommandStorage: disableCommandStorage === 'true' ? true : false } });
this._createOrGetCommandDetection(this._terminal).handleGenericCommand({ genericMarkProperties: { disableCommandStorage: true } });
}
}
// Unrecognized sequence
return false;
}

View file

@ -97,8 +97,7 @@ export const enum VSCodeOscProperty {
*/
export const enum ITermOscPt {
/**
* Set a mark on the scroll bar `OSC 1337 ; SetMark`
* Based on ITerm's `OSC 1337 ; SetMark`
* Based on ITerm's `OSC 1337 ; SetMark` sets a mark on the scrollbar
*/
SetMark = 'SetMark'
}

View file

@ -289,6 +289,10 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
element.classList.add(DecorationSelector.CommandDecoration, DecorationSelector.Codicon, DecorationSelector.XtermDecoration);
if (genericMarkProperties) {
element.classList.add(DecorationSelector.DefaultColor, DecorationSelector.GenericMarkerIcon);
if (!genericMarkProperties.hoverMessage) {
//disable the mouse pointer
element.classList.add(DecorationSelector.Default);
}
} else if (exitCode === undefined) {
element.classList.add(DecorationSelector.DefaultColor, DecorationSelector.Default);
element.classList.add(`codicon-${this._configurationService.getValue(TerminalSettingId.ShellIntegrationDecorationIcon)}`);
@ -319,9 +323,12 @@ export class DecorationAddon extends Disposable implements ITerminalAddon {
this._hoverDelayer.trigger(() => {
let hoverContent = `${localize('terminalPromptContextMenu', "Show Command Actions")}...`;
hoverContent += '\n\n---\n\n';
if (command.genericMarkProperties?.hoverMessage) {
// TODO:@meganrogge localize
hoverContent = command.genericMarkProperties.hoverMessage;
if (command.genericMarkProperties) {
if (command.genericMarkProperties.hoverMessage) {
hoverContent = command.genericMarkProperties.hoverMessage;
} else {
return;
}
} else if (command.exitCode) {
if (command.exitCode === -1) {
hoverContent += localize('terminalPromptCommandFailed', 'Command executed {0} and failed', fromNow(command.timestamp, true));