fix: settings check && status ui bar
This commit is contained in:
parent
eeacc67d70
commit
918b99d741
@ -16,7 +16,8 @@ abstract class State implements EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleSettingChanged(settings: InfioSettings): void {
|
handleSettingChanged(settings: InfioSettings): void {
|
||||||
const settingErrors = checkForErrors(settings);
|
const settingErrors = checkForErrors(settings);
|
||||||
|
console.log(settingErrors);
|
||||||
if (!settings.autocompleteEnabled) {
|
if (!settings.autocompleteEnabled) {
|
||||||
new Notice("Copilot is now disabled.");
|
new Notice("Copilot is now disabled.");
|
||||||
this.context.transitionToDisabledManualState()
|
this.context.transitionToDisabledManualState()
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class EventListener implements EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getStatusBarText(): string {
|
getStatusBarText(): string {
|
||||||
return `Copilot: ${this.state.getStatusBarText()}`;
|
return `autocomplete: ${this.state.getStatusBarText()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSettingChanged(settings: InfioSettings): void {
|
handleSettingChanged(settings: InfioSettings): void {
|
||||||
|
|||||||
@ -57,7 +57,7 @@ export const triggerSchema = z.object({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const InfioSettingsSchema = z.object({
|
export const InfioSettingsSchema = z.object({
|
||||||
// Version
|
// Version
|
||||||
version: z.literal(SETTINGS_SCHEMA_VERSION).catch(SETTINGS_SCHEMA_VERSION),
|
version: z.literal(SETTINGS_SCHEMA_VERSION).catch(SETTINGS_SCHEMA_VERSION),
|
||||||
|
|
||||||
|
|||||||
@ -4,15 +4,15 @@ import * as mm from "micromatch";
|
|||||||
import { err, ok, Result } from "neverthrow";
|
import { err, ok, Result } from "neverthrow";
|
||||||
import { z, ZodError, ZodIssueCode, ZodType } from 'zod';
|
import { z, ZodError, ZodIssueCode, ZodType } from 'zod';
|
||||||
|
|
||||||
import { DEFAULT_SETTINGS, PluginData, Settings, settingsSchema } from "../settings/versions";
|
import { DEFAULT_SETTINGS, PluginData, Settings } from "../settings/versions";
|
||||||
import { isSettingsV0, isSettingsV1, migrateFromV0ToV1 } from "../settings/versions/migration";
|
import { isSettingsV0, isSettingsV1, migrateFromV0ToV1 } from "../settings/versions/migration";
|
||||||
import { InfioSettings } from '../types/settings';
|
import { InfioSettings, InfioSettingsSchema } from '../types/settings';
|
||||||
|
|
||||||
type JSONObject = Record<string, any>;
|
type JSONObject = Record<string, any>;
|
||||||
|
|
||||||
export function checkForErrors(settings: InfioSettings) {
|
export function checkForErrors(settings: InfioSettings) {
|
||||||
const errors = new Map<string, string>();
|
const errors = new Map<string, string>();
|
||||||
const parsingResult = parseWithSchema(settingsSchema, settings);
|
const parsingResult = parseWithSchema(InfioSettingsSchema, settings);
|
||||||
|
|
||||||
if (parsingResult.isOk()) {
|
if (parsingResult.isOk()) {
|
||||||
return errors;
|
return errors;
|
||||||
|
|||||||
@ -268,7 +268,7 @@ button:not(.clickable-icon).infio-chat-list-dropdown {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
background: var(--background-modifier-form-field);
|
background: var(--background-secondary-alt);
|
||||||
border: var(--input-border-width) solid var(--background-modifier-border);
|
border: var(--input-border-width) solid var(--background-modifier-border);
|
||||||
color: var(--text-normal);
|
color: var(--text-normal);
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@ -1252,8 +1252,8 @@ input[type='text'].infio-chat-list-dropdown-item-title-input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.infio-ai-block-container {
|
.infio-ai-block-container {
|
||||||
background: var(--background-primary);
|
background: var(--background-secondary-alt);
|
||||||
border-radius: 6px;
|
border-radius: 4px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
border: 1px solid var(--background-modifier-border);
|
border: 1px solid var(--background-modifier-border);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user