From d8e6ca5813de414a77600edd7c23b53b561be5c8 Mon Sep 17 00:00:00 2001 From: Aincvy Date: Wed, 3 Jan 2024 11:35:47 +0800 Subject: [PATCH] Remove unused file and invalid option. --- package.json | 9 ++------- src/Constants.ts | 2 -- src/FauxpilotClient.ts | 9 +-------- src/FauxpilotCompletionProvider.ts | 18 ------------------ 4 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 src/Constants.ts diff --git a/package.json b/package.json index c79f5b2..8b4b5bf 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "fauxpilot", "displayName": "Fauxpilot", "description": "Get completions from Fauxpilot server", - "version": "10.0.1", + "version": "10.0.2", "icon": "assets/icon.png", "keywords": [ "code-suggestion", @@ -116,11 +116,6 @@ "default": ["\n"], "description": "Valid options: empty array, \\n. You cannot expect other values to take effect. This should be a backend issue, not a problem with this plugin." }, - "fauxpilot.trim1stLineBreak": { - "type":"boolean", - "default": false, - "description": "Should it be removed if there are no characters before the first `\\n`, or if there are only spaces?" - }, "fauxpilot.resendIfEmptyResponse" : { "type": "boolean", "default" : false, @@ -133,7 +128,7 @@ }, "fauxpilot.trimLeadingWhitespace": { "type": "boolean", - "default": false, + "default": true, "description": "Trim leading whitespaces from returned text if the prompt ends in whitespace or if there are multiple white spaces returned." } } diff --git a/src/Constants.ts b/src/Constants.ts deleted file mode 100644 index 8e3760d..0000000 --- a/src/Constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Proportion of lines from the beginning of the file in the prompt -export const LEADING_LINES_PROP = 0.21; diff --git a/src/FauxpilotClient.ts b/src/FauxpilotClient.ts index 352fc09..509d14d 100644 --- a/src/FauxpilotClient.ts +++ b/src/FauxpilotClient.ts @@ -25,7 +25,6 @@ export class FauxpilotClient { private serverMaxTokens: number; private leadingLinesRatio: number; private reduceLineTryTimes: number; - private trim1stLineBreak = false; private resendIfEmptyResponse = false; private fetchWithoutLineBreak = false; private trimLeadingWhitespace = false; @@ -80,7 +79,6 @@ export class FauxpilotClient { this.maxLines = extConfig.get("maxLines", 150); this.serverMaxTokens = extConfig.get("serverMaxTokens", 2048); this.reduceLineTryTimes = extConfig.get("reduceLineTryTimes", 2); - this.trim1stLineBreak = extConfig.get("trim1stLineBreak", false); this.resendIfEmptyResponse = extConfig.get("resendIfEmptyResponse", false); this.trimLeadingWhitespace = extConfig.get("trimLeadingWhitespace", false); @@ -97,7 +95,6 @@ export class FauxpilotClient { this.log(`maxLines = ${this.maxLines}`); this.log(`serverMaxTokens = ${this.serverMaxTokens}`); this.log(`reduceLineTryTimes = ${this.reduceLineTryTimes}`); - this.log(`trim1stLineBreak = ${this.trim1stLineBreak}`); this.log(`resendIfEmptyResponse = ${this.resendIfEmptyResponse}`); this.log(`trimLeadingWhitespace = ${this.trimLeadingWhitespace}`); @@ -186,11 +183,7 @@ export class FauxpilotClient { public get ReduceLineTryTimes(): number { return this.reduceLineTryTimes; } - - public get IsTrim1stLineBreak(): boolean { - return this.trim1stLineBreak; - } - + public get ResendIfEmptyResponse(): boolean { return this.resendIfEmptyResponse; } diff --git a/src/FauxpilotCompletionProvider.ts b/src/FauxpilotCompletionProvider.ts index 5a37088..a063d66 100644 --- a/src/FauxpilotCompletionProvider.ts +++ b/src/FauxpilotCompletionProvider.ts @@ -6,7 +6,6 @@ import { } from 'vscode'; import { nextId,delay, limitTextLength } from './Utils'; -import { LEADING_LINES_PROP } from './Constants'; import { fauxpilotClient } from './FauxpilotClient'; import { fetch } from './AccessBackend'; @@ -199,23 +198,6 @@ export class FauxpilotCompletionProvider implements InlineCompletionItemProvider return []; } - if (fauxpilotClient.IsTrim1stLineBreak) { - const lineIndex = choice1Text.indexOf("\n"); - if (lineIndex >= 0) { - let erase = true; - for (let i = 0; i < lineIndex; i++){ - if (choice1Text[i] != " ") { - erase = false; - break; - } - } - - if (erase) { - choice1Text = choice1Text.substring(lineIndex + 1); - } - } - } - if (fauxpilotClient.TrimLeadingWhitespace) { const trailingWhiteSpace = promptStr.endsWith(" "); if (trailingWhiteSpace) {