mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 01:25:37 -05:00
Generate temp files as not dirty (#3698)
* Generate temp files as not dirty * Remove whitespace
This commit is contained in:
@@ -346,6 +346,11 @@ let registryProperties = {
|
||||
'description': localize('showConnectionInfoInTitle', "Controls whether to show the connection info for a tab in the title."),
|
||||
'default': true
|
||||
},
|
||||
'sql.promptToSaveGeneratedFiles': {
|
||||
'type': 'boolean',
|
||||
'default': false,
|
||||
'description': localize('sql.promptToSaveGeneratedFiles', 'Prompt to save generated SQL files')
|
||||
},
|
||||
'mssql.intelliSense.enableIntelliSense': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
@@ -413,6 +418,3 @@ configurationRegistry.registerConfiguration({
|
||||
'type': 'object',
|
||||
'properties': registryProperties
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface IQueryEditorService {
|
||||
_serviceBrand: any;
|
||||
|
||||
// Creates new untitled document for SQL queries and opens it in a new editor tab
|
||||
newSqlEditor(sqlContent?: string, connectionProviderName?: string): Promise<IConnectableInput>;
|
||||
newSqlEditor(sqlContent?: string, connectionProviderName?: string, isDirty?: boolean): Promise<IConnectableInput>;
|
||||
|
||||
// Creates a new query plan document
|
||||
newQueryPlanEditor(xmlShowPlan: string): Promise<any>;
|
||||
|
||||
@@ -29,6 +29,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import { EditDataResultsInput } from 'sql/parts/editData/common/editDataResultsInput';
|
||||
import { IEditorInput, IEditor } from 'vs/workbench/common/editor';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -61,7 +62,8 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
) {
|
||||
QueryEditorService.editorService = _editorService;
|
||||
QueryEditorService.instantiationService = _instantiationService;
|
||||
@@ -74,7 +76,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
/**
|
||||
* Creates new untitled document for SQL query and opens in new editor tab
|
||||
*/
|
||||
public newSqlEditor(sqlContent?: string, connectionProviderName?: string): Promise<IConnectableInput> {
|
||||
public newSqlEditor(sqlContent?: string, connectionProviderName?: string, isDirty?: boolean): Promise<IConnectableInput> {
|
||||
return new Promise<IConnectableInput>((resolve, reject) => {
|
||||
try {
|
||||
// Create file path and file URI
|
||||
@@ -86,6 +88,9 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
fileInput.resolve().then(m => {
|
||||
if (sqlContent) {
|
||||
m.textEditorModel.setValue(sqlContent);
|
||||
if (isDirty === false || (isDirty === undefined && !this._configurationService.getValue<boolean>('sql.promptToSaveGeneratedFiles'))) {
|
||||
m.setDirty(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user