updateHint()

in src/common/quick_chat/quick_chat_hint.ts [16:40]


  updateHint(event: vscode.TextEditorSelectionChangeEvent) {
    const editor = event.textEditor;
    const selection = event.selections[0];

    if (
      !this.#isHintEnabled || // if user disabled the hint in settings
      selection.isEmpty || // if there is no selected text
      editor.document.uri.scheme !== 'file' // if we are not in a file
    ) {
      editor.setDecorations(this.#hintDecoration, []);
      return;
    }

    const position = this.#calculateHintPosition(editor, selection);
    if (!position) {
      editor.setDecorations(this.#hintDecoration, []);
      return;
    }

    editor.setDecorations(this.#hintDecoration, [
      {
        range: new vscode.Range(position, position),
      },
    ]);
  }