Repository: TabbyML/tabby
File: clients/vscode/src/Config.ts (TypeScript)

Code before:
  }

  set serverToken(value: string) {
    if (value !== this.serverToken) {
      this.memento.update("server.token", value);
      this.emit("updated");
    }
  }

  get inlineCompletionTriggerMode(): "automatic" | "manual" {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    return advancedSettings["inlineCompletion.triggerMode"] || "automatic";
  }

  set inlineCompletionTriggerMode(value: "automatic" | "manual") {
    if (value !== this.inlineCompletionTriggerMode) {
      const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
      const updatedValue = { ...advancedSettings, "inlineCompletion.triggerMode": value };
      this.workspace.update("settings.advanced", updatedValue, ConfigurationTarget.Global);
      this.emit("updated");
    }
  }

  get useVSCodeProxy(): boolean {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    return advancedSettings["useVSCodeProxy"] || true;
  }

  get maxChatEditHistory(): number {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    const numHistory = advancedSettings["chatEdit.history"] === undefined ? 20 : advancedSettings["chatEdit.history"];
    if (numHistory < 0) {
      return 20;
    } else if (numHistory === 0) {
      return 0;
    } else {
      return numHistory;
    }
  }

  set maxChatEditHistory(value: number) {
    if (value != this.maxChatEditHistory) {
      const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
      const updateValue = { ...advancedSettings, "chatEdit.history": value };
      this.workspace.update("settings.advanced", updateValue, ConfigurationTarget.Global);
      this.emit("updated");
    }
  }

  get inlineCompletionEnabled(): boolean {
    return workspace.getConfiguration("editor").get("inlineSuggest.enabled", true);

Review comment (suggestion):
```suggestion
    return advancedSettings["useVSCodeProxy"] ?? true;
```
`anything || true` will always return `true`.

Code after:
  }

  set serverToken(value: string) {
    if (value !== this.serverToken) {
      this.memento.update("server.token", value);
      this.emit("updated");
    }
  }

  get inlineCompletionTriggerMode(): "automatic" | "manual" {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    return advancedSettings["inlineCompletion.triggerMode"] || "automatic";
  }

  set inlineCompletionTriggerMode(value: "automatic" | "manual") {
    if (value !== this.inlineCompletionTriggerMode) {
      const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
      const updatedValue = { ...advancedSettings, "inlineCompletion.triggerMode": value };
      this.workspace.update("settings.advanced", updatedValue, ConfigurationTarget.Global);
      this.emit("updated");
    }
  }

  get useVSCodeProxy(): boolean {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    return advancedSettings["useVSCodeProxy"] ?? true;
  }

  get maxChatEditHistory(): number {
    const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
    const numHistory = advancedSettings["chatEdit.history"] === undefined ? 20 : advancedSettings["chatEdit.history"];
    if (numHistory < 0) {
      return 20;
    } else if (numHistory === 0) {
      return 0;
    } else {
      return numHistory;
    }
  }

  set maxChatEditHistory(value: number) {
    if (value != this.maxChatEditHistory) {
      const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
      const updateValue = { ...advancedSettings, "chatEdit.history": value };
      this.workspace.update("settings.advanced", updateValue, ConfigurationTarget.Global);
      this.emit("updated");
    }
  }

  get inlineCompletionEnabled(): boolean {
    return workspace.getConfiguration("editor").get("inlineSuggest.enabled", true);