continue icon indicating copy to clipboard operation
continue copied to clipboard

Autocompletion not working inside quotes/brackets

Open LuRenJiasWorld opened this issue 1 year ago • 0 comments

Before submitting your bug report

Relevant environment info

- OS: ArchLinux
- Continue: 0.9.198
- IDE: VSCode
- Model: starcode2-7b
- config.json:
  
{
  "models": [
    {
      "title": "CodeGeex4",
      "model": "codegeex4",
      "apiBase": "******",
      "provider": "ollama"
    },
    {
      "title": "DeepSeek-Coder-V2-16B",
      "model": "deepseek-coder-v2",
      "apiBase": "******",
      "provider": "ollama"
    },
    {
      "title": "Codestral",
      "model": "codestral",
      "apiBase": "******",
      "provider": "ollama"
    },
    {
      "title": "starcoder-q4f16_1-MLC",
      "model": "starcoder-q4f16_1-MLC",
      "apiBase": "******",
      "provider": "openai",
      "apiKey": "123"
    }
  ],
  "customCommands": [
    {
      "name": "test",
      "prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "tabAutocompleteModel": {
    "title": "starcoder-q4f16_1-MLC",
    "model": "starcoder-q4f16_1-MLC",
    "apiBase": "http://******/v1",
    "provider": "openai",
    "apiKey": "123",
    "useLegacyCompletionsEndpoint": false
  },
  "embeddingsProvider": {
    "title": "Nomic Embed Text",
    "model": "nomic-embed-text",
    "apiBase": "http://******:11434",
    "provider": "ollama"
  },
  "completionOptions": {
    "temperature": 0.4,
    "maxTokens": 600
  },
  "tabAutocompleteOptions": {
    "useFileSuffix": true,
    "maxPromptTokens": 800,
    "prefixPercentage": 0.65,
    "debounceDelay": 1500,
    "useOtherFiles": true,
    "useCopyBuffer": false,
    "multilineCompletions": "auto"
  },
  "contextProviders": [
    {
      "name": "code",
      "params": {}
    },
    {
      "name": "docs",
      "params": {}
    },
    {
      "name": "diff",
      "params": {}
    },
    {
      "name": "terminal",
      "params": {}
    },
    {
      "name": "problems",
      "params": {}
    },
    {
      "name": "folder",
      "params": {}
    },
    {
      "name": "codebase",
      "params": {}
    }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "share",
      "description": "Export the current chat session to markdown"
    },
    {
      "name": "cmd",
      "description": "Generate a shell command"
    },
    {
      "name": "commit",
      "description": "Generate a git commit message"
    }
  ],
  "reranker": {
    "name": "free-trial"
  },
  "experimental": {
    "quickActions": [
      {
        "title": "Log Args",
        "prompt": "Add logs at the first line of this block of code, containing function name and args, args should be printed beautified"
      }
    ],
  }
}

Description

image

According to the plugin's output, starcoder2 has returned the valid completion I want, but when I'm in quotes/brackets, this plugin does not provide autocompletion unless I remove all quotes/brackets at the right of the cursor.

To reproduce

  1. Write some function call like console.log()
  2. Wait for autocompletion API call ended, and see if the API returns the valid completion result
  3. Nothing happened in editor, even If I invoke the completion command using keyboard shortcuts.
  4. However, after I remove all quotes and brackets at the right of the cursor, the autocompletion works again: image

Log output

<fim_prefix>    globalCompositeOperation: string;
    filter: string;
    imageSmoothingEnabled: boolean;
    imageSmoothingQuality: ImageSmoothingQuality;
    lineCap: CanvasLineCap;
    miterLimit: number;
    shadowBlur: number;
    shadowColor: string;
    shadowOffsetX: number;
    shadowOffsetY: number;
    direction: CanvasDirection;
    textAlign: CanvasTextAlign;
    textBaseline: CanvasTextBaseline;
    lineDash?: string | undefined;
    fontProp: any;
    private readonly ofdKitConverter: OfdKitConverter;

    constructor(options: ICanvas2OfdContext2DOptions, renderContext: RenderContext) {
        this.ofdKitConverter = new OfdKitConverter({
            width: pxToMm(options.width, this.dpi),
            height: pxToMm(options.height, this.dpi),
            dpi: this.dpi,
            tweaks: {
                experimentalRgbaSupport: true,
            },
        });

        renderContext?.editor?.font?.().forEach((value: string, key: string) => {
            this.ofdKitConverter.api.addFont({
                fontData: value,
            });
        });
    }

    ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void {
        throw new Error('Method not implemented.');
    }

    public getTransform(): DOMMatrix {
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        return this.ofdKitConverter.context2d.getTransform();
    }

    public resetTransform(): void {
        this.ofdKitConverter.context2d.resetTransform();
    }

    public setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void {
        console.log('setTransform called with arguments'<fim_suffix>)

        this.ofdKitConverter.context2d.setTransform(a, b, c, d, e, f);
    }

    drawFocusIfNeeded(element: Element): void;
    drawFocusIfNeeded(path: Path2D, element: Element): void;
    drawFocusIfNeeded(path: any, element?: any);
    drawFocusIfNeeded(path: unknown, element?: unknown): any {
        throw new Error('Method not implemented.');
    }
    scrollPathIntoView(path?: Path2D | undefined): void {
        throw new Error('Method not implemented.');
    }<fim_middle>==========================================================================
==========================================================================
Completion:

, a, b, c, d, e, f

LuRenJiasWorld avatar Aug 22 '24 13:08 LuRenJiasWorld