@@ -7,6 +7,11 @@ import {codeAssistApi} from '../../../../store/reducers/codeAssist/codeAssist';
7
7
import type { TelemetryOpenTabs } from '../../../../types/api/codeAssist' ;
8
8
import { AUTOCOMPLETE_ON_ENTER , ENABLE_AUTOCOMPLETE } from '../../../../utils/constants' ;
9
9
import { useSetting } from '../../../../utils/hooks' ;
10
+ import { YQL_LANGUAGE_ID } from '../../../../utils/monaco/constats' ;
11
+
12
+ const limitForTab = 10_000 ;
13
+ const limitBeforeCursor = 8_000 ;
14
+ const limitAfterCursor = 1_000 ;
10
15
11
16
export type EditorOptions = Monaco . editor . IEditorOptions & Monaco . editor . IGlobalEditorOptions ;
12
17
@@ -67,7 +72,7 @@ export function useCodeAssist() {
67
72
async ( queries : { text : string ; name ?: string } [ ] ) => {
68
73
const preparedData : TelemetryOpenTabs = queries . map ( ( query , index ) => ( {
69
74
FileName : query . name || `query${ index } .yql` ,
70
- Text : query . text ,
75
+ Text : query . text . slice ( 0 , limitForTab ) ,
71
76
} ) ) ;
72
77
try {
73
78
return sendUserQueriesData ( preparedData ) . unwrap ( ) ;
@@ -78,7 +83,16 @@ export function useCodeAssist() {
78
83
[ sendUserQueriesData ] ,
79
84
) ;
80
85
86
+ const config = {
87
+ language : YQL_LANGUAGE_ID ,
88
+ textLimits : {
89
+ beforeCursor : limitBeforeCursor ,
90
+ afterCursor : limitAfterCursor ,
91
+ } ,
92
+ } ;
93
+
81
94
return {
95
+ config,
82
96
getCodeAssistSuggestions,
83
97
onCompletionAccept,
84
98
onCompletionDecline,
0 commit comments