diff --git a/src/tabnineChatWidget/extensionCommands/codeLens/ChatCodeLensProvider.ts b/src/tabnineChatWidget/extensionCommands/codeLens/ChatCodeLensProvider.ts index 58c569d386..a9de2df4bf 100644 --- a/src/tabnineChatWidget/extensionCommands/codeLens/ChatCodeLensProvider.ts +++ b/src/tabnineChatWidget/extensionCommands/codeLens/ChatCodeLensProvider.ts @@ -18,11 +18,16 @@ const CODE_LENS_ACTIONS = [ const VALID_SYMBOLS = [SymbolKind.Function, SymbolKind.Method]; +const MAX_LINES = 2500; + export default class ChatCodeLensProvider implements CodeLensProvider { // eslint-disable-next-line class-methods-use-this public async provideCodeLenses( document: TextDocument ): Promise { + if (document.lineCount > MAX_LINES) { + return []; + } const documnetSymbols = await commands.executeCommand< (SymbolInformation & DocumentSymbol)[] >("vscode.executeDocumentSymbolProvider", document.uri); diff --git a/src/tabnineChatWidget/extensionCommands/codeLens/index.ts b/src/tabnineChatWidget/extensionCommands/codeLens/index.ts index 62863d890f..c0d8d3f109 100644 --- a/src/tabnineChatWidget/extensionCommands/codeLens/index.ts +++ b/src/tabnineChatWidget/extensionCommands/codeLens/index.ts @@ -10,6 +10,7 @@ import { import ChatCodeLensProvider from "./ChatCodeLensProvider"; import ChatViewProvider from "../../ChatViewProvider"; import tabnineExtensionProperties from "../../../globals/tabnineExtensionProperties"; +import { fireEvent } from "../../../binary/requests/requests"; const languagesFilter = [ { language: "javascript" }, @@ -42,6 +43,12 @@ export default function registerChatCodeLens( commands.registerCommand( "tabnine.chat.commands.any", (range: Range, intent: string) => { + void fireEvent({ + name: "chat-lens-action", + intent, + language: window.activeTextEditor?.document.languageId, + }); + const editor = window.activeTextEditor; if (editor) { const newSelection = new Selection(range.start, range.end); @@ -51,6 +58,12 @@ export default function registerChatCodeLens( } ), commands.registerCommand("tabnine.chat.commands.ask", (range: Range) => { + void fireEvent({ + name: "chat-lens-action", + intent: "ask-question", + language: window.activeTextEditor?.document.languageId, + }); + const editor = window.activeTextEditor; if (editor) { const newSelection = new Selection(range.start, range.end);