Skip to content

Commit f886288

Browse files
authored
feat(improve-grid):Improve grid issues (#87)
1 parent 5d6c6bc commit f886288

File tree

15 files changed

+3280
-242
lines changed

15 files changed

+3280
-242
lines changed

src/main/js/components/editor/editor-hybrid.js

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,27 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
1616

1717
// Extract field names from vespaState schema content
1818
useEffect(() => {
19-
console.log("EditorHybrid: vespaState received:", vespaState);
20-
2119
if (vespaState && vespaState.content && vespaState.content.clusters) {
2220
const allFields = [];
23-
24-
console.log("EditorHybrid: Processing clusters:", vespaState.content.clusters.length);
25-
2621
vespaState.content.clusters.forEach((cluster, clusterIndex) => {
27-
console.log(`EditorHybrid: Cluster ${clusterIndex}:`, cluster.name, "contentData count:", cluster.contentData.length);
28-
2922
cluster.contentData.forEach((contentData, dataIndex) => {
3023
const schemaContent = contentData.schema.schemaContent;
31-
console.log(`EditorHybrid: Schema ${dataIndex} (${contentData.schema.schemaName}):`, schemaContent.substring(0, 200) + "...");
32-
3324
// Extract field names from schema content (.sd file)
3425
const fieldMatches = schemaContent.match(/field\s+(\w+)\s+type/g);
35-
console.log("EditorHybrid: Field matches found:", fieldMatches);
36-
3726
if (fieldMatches) {
3827
fieldMatches.forEach(match => {
3928
const fieldName = match.match(/field\s+(\w+)\s+type/)[1];
40-
console.log("EditorHybrid: Extracted field name:", fieldName);
4129
if (!allFields.includes(fieldName)) {
4230
allFields.push(fieldName);
4331
}
4432
});
4533
} else {
4634
// Try alternative patterns
47-
console.log("EditorHybrid: Trying alternative field pattern...");
4835
const altMatches = schemaContent.match(/field\s+(\w+)\s*{/g);
49-
console.log("EditorHybrid: Alternative matches:", altMatches);
50-
36+
5137
if (altMatches) {
5238
altMatches.forEach(match => {
5339
const fieldName = match.match(/field\s+(\w+)\s*{/)[1];
54-
console.log("EditorHybrid: Alternative extracted field name:", fieldName);
5540
if (!allFields.includes(fieldName)) {
5641
allFields.push(fieldName);
5742
}
@@ -61,7 +46,6 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
6146
});
6247
});
6348

64-
console.log("EditorHybrid: All extracted fields:", allFields);
6549
setSchemaFields(allFields.sort());
6650
} else {
6751
console.log("EditorHybrid: vespaState not available or incomplete");
@@ -180,8 +164,6 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
180164
const [schemaCompleter, setSchemaCompleter] = useState(null);
181165

182166
useEffect(() => {
183-
console.log("EditorHybrid: Creating new schemaCompleter with fields:", schemaFields);
184-
185167
const newCompleter = {
186168
getCompletions: function(editor, session, pos, prefix, callback) {
187169
const completions = [];
@@ -192,17 +174,12 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
192174

193175
// Check if we're inside any string value
194176
const stringContext = this.getStringContext(beforeCursor);
195-
console.log("EditorHybrid: String context for prefix '" + prefix + "':", stringContext);
196-
console.log("EditorHybrid: beforeCursor:", beforeCursor);
197-
198177
if (stringContext.inString) {
199178
if (stringContext.isYQLString && !stringContext.insideSingleQuotes && !stringContext.insideEscapedQuotes) {
200179
// Inside YQL string but not inside quotes - provide field completions
201-
console.log("EditorHybrid: Inside YQL string, outside quotes - providing completions");
202180
this.getFieldCompletions(completions, prefix);
203181
} else {
204182
// Inside any other string value OR inside quotes in YQL - disable completions
205-
console.log("EditorHybrid: Inside string value or inside quotes - disabling completions");
206183
callback(null, []);
207184
return;
208185
}
@@ -342,9 +319,7 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
342319

343320
yqlContent += char;
344321
}
345-
346-
console.log("EditorHybrid: YQL content extracted:", yqlContent);
347-
322+
348323
// Count unescaped single quotes and escaped double quotes
349324
let singleQuoteCount = 0;
350325
let escapedQuoteCount = 0;
@@ -367,17 +342,11 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
367342
singleQuoteCount++;
368343
}
369344
}
370-
371-
console.log("EditorHybrid: Single quote count:", singleQuoteCount);
372-
console.log("EditorHybrid: Escaped quote count:", escapedQuoteCount);
373-
345+
374346
// If odd number of quotes, we're inside quotes
375347
const insideSingleQuotes = singleQuoteCount % 2 === 1;
376348
const insideEscapedQuotes = escapedQuoteCount % 2 === 1;
377-
378-
console.log("EditorHybrid: Inside single quotes:", insideSingleQuotes);
379-
console.log("EditorHybrid: Inside escaped quotes:", insideEscapedQuotes);
380-
349+
381350
return {
382351
insideSingleQuotes: insideSingleQuotes,
383352
insideEscapedQuotes: insideEscapedQuotes
@@ -617,15 +586,10 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
617586
},
618587

619588
getFieldCompletions: function(completions, prefix) {
620-
console.log("EditorHybrid: getFieldCompletions called with prefix:", prefix);
621-
console.log("EditorHybrid: Available schemaFields:", schemaFields);
622-
623589
// Use schema fields extracted from vespaState
624590
if (schemaFields.length > 0) {
625-
console.log("EditorHybrid: Adding schema fields to completions");
626591
schemaFields.forEach(field => {
627592
if (!prefix || field.toLowerCase().includes(prefix.toLowerCase())) {
628-
console.log("EditorHybrid: Adding field completion:", field);
629593
completions.push({
630594
caption: field,
631595
snippet: field,
@@ -635,7 +599,6 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
635599
}
636600
});
637601
} else {
638-
console.log("EditorHybrid: No schema fields available, adding fallback fields");
639602
// Add some fallback fields for testing
640603
const fallbackFields = ['title', 'content', 'id', 'url'];
641604
fallbackFields.forEach(field => {
@@ -651,10 +614,7 @@ function EditorHybrid({query, setQuery, handleRunQuery, handleFormatQuery, vespa
651614
}
652615

653616
// Add YQL keywords
654-
console.log("EditorHybrid: Adding YQL keywords");
655617
this.addYQLKeywords(completions, prefix);
656-
657-
console.log("EditorHybrid: Total completions added:", completions.length);
658618
},
659619

660620
addYQLKeywords: function(completions, prefix) {

0 commit comments

Comments
 (0)