mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix query editors restoring as plain text (#17643)
This commit is contained in:
@@ -206,6 +206,11 @@ export class QueryEditor extends EditorPane {
|
|||||||
this._register(this.connectionManagementService.onLanguageFlavorChanged(() => {
|
this._register(this.connectionManagementService.onLanguageFlavorChanged(() => {
|
||||||
this.setTaskbarContent();
|
this.setTaskbarContent();
|
||||||
}));
|
}));
|
||||||
|
this._register(this.capabilitiesService.onCapabilitiesRegistered(c => {
|
||||||
|
if (c.id === this.currentProvider) {
|
||||||
|
this.setTaskbarContent();
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -268,13 +273,17 @@ export class QueryEditor extends EditorPane {
|
|||||||
return this._listDatabasesActionItem;
|
return this._listDatabasesActionItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private setTaskbarContent(): void {
|
private get currentProvider(): string | undefined {
|
||||||
const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
|
||||||
const connectionProfile = this.connectionManagementService.getConnectionProfile(this.input?.uri);
|
const connectionProfile = this.connectionManagementService.getConnectionProfile(this.input?.uri);
|
||||||
const fileExtension = path.extname(this.input?.uri || '');
|
return connectionProfile?.providerName ||
|
||||||
const providerId = connectionProfile?.providerName ||
|
|
||||||
this.connectionManagementService.getProviderIdFromUri(this.input?.uri) ||
|
this.connectionManagementService.getProviderIdFromUri(this.input?.uri) ||
|
||||||
this.connectionManagementService.getDefaultProviderId();
|
this.connectionManagementService.getDefaultProviderId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private setTaskbarContent(): void {
|
||||||
|
const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||||
|
const fileExtension = path.extname(this.input?.uri || '');
|
||||||
|
const providerId = this.currentProvider;
|
||||||
const content: ITaskbarContent[] = [
|
const content: ITaskbarContent[] = [
|
||||||
{ action: this._runQueryAction },
|
{ action: this._runQueryAction },
|
||||||
{ action: this._cancelQueryAction },
|
{ action: this._cancelQueryAction },
|
||||||
@@ -294,7 +303,8 @@ export class QueryEditor extends EditorPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only show the databases dropdown if the connection provider supports it.
|
// Only show the databases dropdown if the connection provider supports it.
|
||||||
if (this.capabilitiesService.getCapabilities(providerId).connection?.connectionOptions?.find(option => option.specialValueType === ConnectionOptionSpecialType.databaseName)) {
|
// If the provider we're using isn't registered yet then default to not showing it - we'll update once the provider is registered
|
||||||
|
if (this.capabilitiesService.getCapabilities(providerId)?.connection?.connectionOptions?.find(option => option.specialValueType === ConnectionOptionSpecialType.databaseName)) {
|
||||||
content.push({ action: this._listDatabasesAction });
|
content.push({ action: this._listDatabasesAction });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user