mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -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.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;
|
||||
}
|
||||
|
||||
private setTaskbarContent(): void {
|
||||
const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
private get currentProvider(): string | undefined {
|
||||
const connectionProfile = this.connectionManagementService.getConnectionProfile(this.input?.uri);
|
||||
const fileExtension = path.extname(this.input?.uri || '');
|
||||
const providerId = connectionProfile?.providerName ||
|
||||
return connectionProfile?.providerName ||
|
||||
this.connectionManagementService.getProviderIdFromUri(this.input?.uri) ||
|
||||
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[] = [
|
||||
{ action: this._runQueryAction },
|
||||
{ action: this._cancelQueryAction },
|
||||
@@ -294,7 +303,8 @@ export class QueryEditor extends EditorPane {
|
||||
}
|
||||
|
||||
// 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 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user