Skip to content

Commit

Permalink
Merge branch 'main' into joh/irrelevant-worm
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken authored Dec 6, 2024
2 parents 0f695e4 + d6faa5b commit 2ccf448
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import { IContextMenuService } from '../../../../platform/contextview/browser/co
import { toAction } from '../../../../base/common/actions.js';
import { IMouseEvent } from '../../../../base/browser/mouseEvent.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { Event } from '../../../../base/common/event.js';
import { observableCodeEditor } from '../../../../editor/browser/observableCodeEditor.js';
import { PLAINTEXT_LANGUAGE_ID } from '../../../../editor/common/languages/modesRegistry.js';
import { createStyleSheet2 } from '../../../../base/browser/domStylesheets.js';
import { stringValue } from '../../../../base/browser/cssValue.js';
import { observableConfigValue } from '../../../../platform/observable/common/platformObservableUtils.js';

export const CTX_INLINE_CHAT_SHOWING_HINT = new RawContextKey<boolean>('inlineChatShowingHint', false, localize('inlineChatShowingHint', "Whether inline chat shows a contextual hint"));

Expand Down Expand Up @@ -208,10 +208,9 @@ export class InlineChatHintsController extends Disposable implements IEditorCont
const decos = this._editor.createDecorationsCollection();

const editorObs = observableCodeEditor(editor);

const keyObs = observableFromEvent(keybindingService.onDidUpdateKeybindings, _ => keybindingService.lookupKeybinding(ACTION_START)?.getLabel());

const configSignal = observableFromEvent(Event.filter(_configurationService.onDidChangeConfiguration, e => e.affectsConfiguration(InlineChatConfigKeys.LineEmptyHint) || e.affectsConfiguration(InlineChatConfigKeys.LineNLHint)), () => undefined);
const configHintEmpty = observableConfigValue(InlineChatConfigKeys.LineEmptyHint, false, this._configurationService);
const configHintNL = observableConfigValue(InlineChatConfigKeys.LineNLHint, false, this._configurationService);

const showDataObs = derived(r => {
const ghostState = ghostCtrl?.model.read(r)?.state.read(r);
Expand All @@ -222,8 +221,6 @@ export class InlineChatHintsController extends Disposable implements IEditorCont

const kb = keyObs.read(r);

configSignal.read(r);

if (ghostState !== undefined || !kb || !position || !model || !textFocus) {
return undefined;
}
Expand All @@ -237,12 +234,12 @@ export class InlineChatHintsController extends Disposable implements IEditorCont
const isWhitespace = model.getLineLastNonWhitespaceColumn(position.lineNumber) === 0 && model.getValueLength() > 0 && position.column > 1;

if (isWhitespace) {
return _configurationService.getValue(InlineChatConfigKeys.LineEmptyHint)
return configHintEmpty.read(r)
? { isEol, isWhitespace, kb, position, model }
: undefined;
}

if (visible && isEol && _configurationService.getValue(InlineChatConfigKeys.LineNLHint)) {
if (visible && isEol && configHintNL.read(r)) {
return { isEol, isWhitespace, kb, position, model };
}

Expand Down

0 comments on commit 2ccf448

Please sign in to comment.