fix language change issue (#18906)

This commit is contained in:
Alan Ren
2022-04-01 17:52:11 -07:00
committed by GitHub
parent 055f10ff8d
commit a795e64bed
2 changed files with 4 additions and 4 deletions

View File

@@ -59,10 +59,6 @@ export class QueryEditorService implements IQueryEditorService {
// Create a sql document pane with accoutrements
const mode = this._connectionManagementService.getProviderLanguageMode(connectionProviderName);
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: mode }) as UntitledTextEditorInput;
// Set the mode explicitely to stop the language detection service from changing the mode unexpectedly.
// The mode parameter used when creating the editorInput is used as preferred mode,
// the language detection service won't do the language change only if the mode is explicitely set.
fileInput.setMode(mode);
let untitledEditorModel = await fileInput.resolve();
if (options.initalContent) {
untitledEditorModel.textEditorModel.setValue(options.initalContent);