Path: blob/main/extensions/copilot/src/extension/completions/common/config.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45/** How to determine where to terminate the completion to the current block. */6export enum BlockMode {7/**8* Parse the context + completion on the client using treesitter to9* determine blocks.10*/11Parsing = 'parsing',12/**13* Let the server parse out blocks and assume that the completion terminates14* at the end of a block.15*/16Server = 'server',17/**18* Runs both the treesitter parsing on the client plus indentation-based19* truncation on the proxy.20*/21ParsingAndServer = 'parsingandserver',22/**23* Client-based heuristic to display more multiline completions.24* It almost always requests a multiline completion from the server and tries to break it up to something useful on the client.25*26* This should not be rolled out at the moment (latency impact is high, UX needs further fine-tuning),27* but can be used for internal experimentation.28*/29MoreMultiline = 'moremultiline',30}3132export function shouldDoParsingTrimming(blockMode: BlockMode): boolean {33return [BlockMode.Parsing, BlockMode.ParsingAndServer, BlockMode.MoreMultiline].includes(blockMode);34}3536export function shouldDoServerTrimming(blockMode: BlockMode): boolean {37return [BlockMode.Server, BlockMode.ParsingAndServer].includes(blockMode);38}394041