Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ export async function activate(context: ExtensionContext)

// Track Kusto session state - keep views visible while in a Kusto session
const updateKustoContext = () => {
// Check if any Kusto documents are open OR if chart panel exists
// Check if any Kusto documents are open OR if singleton results view exists
const hasKustoDocument = vscode.workspace.textDocuments.some(doc => doc.languageId === 'kusto');
const hasChartPanel = resultsViewer.hasChartPanel();
const isKustoActive = hasKustoDocument || hasChartPanel;
const hasSingletonView = resultsViewer.hasSingletonResultsView();
const isKustoActive = hasKustoDocument || hasSingletonView;
vscode.commands.executeCommand('setContext', 'kusto.hasActiveDocument', isKustoActive);
vscode.commands.executeCommand('setContext', 'kusto.hasChartPanel', hasChartPanel);
vscode.commands.executeCommand('setContext', 'kusto.hasSingletonView', hasSingletonView);

// Track whether the active editor is showing a read-only entity definition
const activeEditor = vscode.window.activeTextEditor;
const isEntityDef = activeEditor?.document.uri.scheme === ENTITY_DEFINITION_SCHEME;
vscode.commands.executeCommand('setContext', 'kusto.isEntityDefinition', isEntityDef);
};

// Command to notify when chart panel state changes (triggers context update)
// Command to notify when singleton view state changes (triggers context update)
context.subscriptions.push(
vscode.commands.registerCommand('kusto.chartPanelStateChanged', () => {
vscode.commands.registerCommand('kusto.singletonViewStateChanged', () => {
updateKustoContext();
})
);
Expand Down
4 changes: 2 additions & 2 deletions src/Client/features/copilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as conn from './connections';
import * as server from './server';
import { ENTITY_DEFINITION_SCHEME } from './entityDefinitionProvider';
import { resultTableToMarkdown } from './markdown';
import { displayResultsPanel, displaySingletonResultView, ResultViewMode } from './resultsViewer';
import { displayResultsInPanel, displayResultsInSingletonView, ResultViewMode } from './resultsViewer';

const COPILOT_PARTICIPANT_ID = 'kusto';
const MAX_SCHEMA_CHARS = 30000; // Approximate limit to stay within token limits
Expand Down Expand Up @@ -411,7 +411,7 @@ async function runQuery(input: { query: string; cluster?: string; database?: str
}

if (input.showResults) {
await displaySingletonResultView(languageClient, result.data, 'all', true);
await displayResultsInSingletonView(languageClient, result.data, 'all', true);
}

return resultTableToMarkdown(result.data.tables[0]!);
Expand Down
12 changes: 6 additions & 6 deletions src/Client/features/queryDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as vscode from 'vscode';
import { LanguageClient } from 'vscode-languageclient/node';
import { setDocumentConnection, ensureServer, getDocumentConnection } from './connections';
import * as server from './server';
import { displayResultsPanel, displayError, displaySingletonResultView, ResultViewMode } from './resultsViewer';
import { displayResultsInPanel, displayErrorInPanel, displayResultsInSingletonView, ResultViewMode } from './resultsViewer';
import * as resultsCache from './resultsCache';
import { getClipboardContext, clearClipboardContext, copyToClipboard } from './clipboard';
import { ENTITY_DEFINITION_SCHEME } from './entityDefinitionProvider';
Expand Down Expand Up @@ -139,7 +139,7 @@ async function runQuery(client: LanguageClient, queryRange?: server.SelectionRan
if (runResult && runResult.error)
{
// display error and highlight error range
await displayError(runResult.error);
await displayErrorInPanel(runResult.error);

if (runResult.error.range) {
const r = runResult.error.range;
Expand All @@ -153,8 +153,8 @@ async function runQuery(client: LanguageClient, queryRange?: server.SelectionRan
await resultsCache.addToCache(uri, queryText, runResult.data);

// Display result tables and chart from ResultData
await displayResultsPanel(client, runResult.data, 'data');
await displaySingletonResultView(client, runResult.data, 'chart', true);
await displayResultsInPanel(client, runResult.data, 'data');
await displayResultsInSingletonView(client, runResult.data, 'chart', true);
}

// Refresh CodeLens to show/hide Results lens
Expand Down Expand Up @@ -192,8 +192,8 @@ async function showResults(client: LanguageClient, uri: string, line: number, ch
));
const cachedData = await resultsCache.getFromCache(uri, queryText);
if (cachedData) {
await displayResultsPanel(client, cachedData, 'data');
await displaySingletonResultView(client, cachedData, 'chart', true);
await displayResultsInPanel(client, cachedData, 'data');
await displayResultsInSingletonView(client, cachedData, 'chart', true);
}
} catch (error) {
vscode.window.showErrorMessage(`Failed to show results: ${error}`);
Expand Down
Loading
Loading